minor changes
This commit is contained in:
parent
26adff1fa5
commit
738e40a37d
|
@ -49,8 +49,8 @@ const int32_t TYPE_BYTES[15] = {
|
|||
} \
|
||||
} while (0)
|
||||
|
||||
static void getStatics_bool(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_bool(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
int8_t *data = (int8_t *)pData;
|
||||
*min = INT64_MAX;
|
||||
*max = INT64_MIN;
|
||||
|
@ -133,7 +133,6 @@ static void getStatics_i16(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
|
||||
DO_STATICS(*sum, *min, *max, *minIndex, *maxIndex, data, i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void getStatics_u16(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
|
@ -182,8 +181,8 @@ static void getStatics_i32(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
}
|
||||
}
|
||||
|
||||
static void getStatics_u32(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_u32(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
uint32_t *data = (uint32_t *)pData;
|
||||
uint64_t _min = UINT64_MAX;
|
||||
uint64_t _max = 0;
|
||||
|
@ -208,8 +207,8 @@ static void getStatics_u32(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
*sum = _sum;
|
||||
}
|
||||
|
||||
static void getStatics_i64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_i64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
int64_t *data = (int64_t *)pData;
|
||||
*min = INT64_MAX;
|
||||
*max = INT64_MIN;
|
||||
|
@ -228,8 +227,8 @@ static void getStatics_i64(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
}
|
||||
}
|
||||
|
||||
static void getStatics_u64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_u64(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
uint64_t *data = (uint64_t *)pData;
|
||||
uint64_t _min = UINT64_MAX;
|
||||
uint64_t _max = 0;
|
||||
|
@ -254,8 +253,8 @@ static void getStatics_u64(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
*sum = _sum;
|
||||
}
|
||||
|
||||
static void getStatics_f(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_f(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
float *data = (float *)pData;
|
||||
float fmin = FLT_MAX;
|
||||
float fmax = -FLT_MAX;
|
||||
|
@ -290,8 +289,8 @@ static void getStatics_f(const void *pData, int32_t numOfRow, int64_t *min, int6
|
|||
SET_DOUBLE_VAL(min, fmin);
|
||||
}
|
||||
|
||||
static void getStatics_d(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_d(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
double *data = (double *)pData;
|
||||
double dmin = DBL_MAX;
|
||||
double dmax = -DBL_MAX;
|
||||
|
@ -326,8 +325,8 @@ static void getStatics_d(const void *pData, int32_t numOfRow, int64_t *min, int6
|
|||
SET_DOUBLE_PTR(min, &dmin);
|
||||
}
|
||||
|
||||
static void getStatics_bin(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_bin(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
const char *data = pData;
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
|
@ -346,8 +345,8 @@ static void getStatics_bin(const void *pData, int32_t numOfRow, int64_t *min, in
|
|||
*maxIndex = 0;
|
||||
}
|
||||
|
||||
static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max,
|
||||
int64_t *sum, int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, int64_t *max, int64_t *sum,
|
||||
int16_t *minIndex, int16_t *maxIndex, int16_t *numOfNull) {
|
||||
const char *data = pData;
|
||||
assert(numOfRow <= INT16_MAX);
|
||||
|
||||
|
@ -369,19 +368,26 @@ static void getStatics_nchr(const void *pData, int32_t numOfRow, int64_t *min, i
|
|||
tDataTypeDescriptor tDataTypes[15] = {
|
||||
{TSDB_DATA_TYPE_NULL, 6, 1, "NOTYPE", 0, 0, NULL, NULL, NULL},
|
||||
{TSDB_DATA_TYPE_BOOL, 4, CHAR_BYTES, "BOOL", false, true, tsCompressBool, tsDecompressBool, getStatics_bool},
|
||||
{TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", INT8_MIN, INT8_MAX, tsCompressTinyint, tsDecompressTinyint, getStatics_i8},
|
||||
{TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", INT16_MIN, INT16_MAX, tsCompressSmallint, tsDecompressSmallint, getStatics_i16},
|
||||
{TSDB_DATA_TYPE_TINYINT, 7, CHAR_BYTES, "TINYINT", INT8_MIN, INT8_MAX, tsCompressTinyint, tsDecompressTinyint,
|
||||
getStatics_i8},
|
||||
{TSDB_DATA_TYPE_SMALLINT, 8, SHORT_BYTES, "SMALLINT", INT16_MIN, INT16_MAX, tsCompressSmallint,
|
||||
tsDecompressSmallint, getStatics_i16},
|
||||
{TSDB_DATA_TYPE_INT, 3, INT_BYTES, "INT", INT32_MIN, INT32_MAX, tsCompressInt, tsDecompressInt, getStatics_i32},
|
||||
{TSDB_DATA_TYPE_BIGINT, 6, LONG_BYTES, "BIGINT", INT64_MIN, INT64_MAX, tsCompressBigint, tsDecompressBigint, getStatics_i64},
|
||||
{TSDB_DATA_TYPE_BIGINT, 6, LONG_BYTES, "BIGINT", INT64_MIN, INT64_MAX, tsCompressBigint, tsDecompressBigint,
|
||||
getStatics_i64},
|
||||
{TSDB_DATA_TYPE_FLOAT, 5, FLOAT_BYTES, "FLOAT", 0, 0, tsCompressFloat, tsDecompressFloat, getStatics_f},
|
||||
{TSDB_DATA_TYPE_DOUBLE, 6, DOUBLE_BYTES, "DOUBLE", 0, 0, tsCompressDouble, tsDecompressDouble, getStatics_d},
|
||||
{TSDB_DATA_TYPE_BINARY, 6, 0, "BINARY", 0, 0, tsCompressString, tsDecompressString, getStatics_bin},
|
||||
{TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", INT64_MIN, INT64_MAX, tsCompressTimestamp, tsDecompressTimestamp, getStatics_i64},
|
||||
{TSDB_DATA_TYPE_TIMESTAMP, 9, LONG_BYTES, "TIMESTAMP", INT64_MIN, INT64_MAX, tsCompressTimestamp,
|
||||
tsDecompressTimestamp, getStatics_i64},
|
||||
{TSDB_DATA_TYPE_NCHAR, 5, 8, "NCHAR", 0, 0, tsCompressString, tsDecompressString, getStatics_nchr},
|
||||
{TSDB_DATA_TYPE_UTINYINT, 16, CHAR_BYTES, "TINYINT UNSIGNED", 0, UINT8_MAX, tsCompressTinyint, tsDecompressTinyint, getStatics_u8},
|
||||
{TSDB_DATA_TYPE_USMALLINT, 17, SHORT_BYTES, "SMALLINT UNSIGNED", 0, UINT16_MAX, tsCompressSmallint, tsDecompressSmallint, getStatics_u16},
|
||||
{TSDB_DATA_TYPE_UTINYINT, 16, CHAR_BYTES, "TINYINT UNSIGNED", 0, UINT8_MAX, tsCompressTinyint, tsDecompressTinyint,
|
||||
getStatics_u8},
|
||||
{TSDB_DATA_TYPE_USMALLINT, 17, SHORT_BYTES, "SMALLINT UNSIGNED", 0, UINT16_MAX, tsCompressSmallint,
|
||||
tsDecompressSmallint, getStatics_u16},
|
||||
{TSDB_DATA_TYPE_UINT, 12, INT_BYTES, "INT UNSIGNED", 0, UINT32_MAX, tsCompressInt, tsDecompressInt, getStatics_u32},
|
||||
{TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint, getStatics_u64},
|
||||
{TSDB_DATA_TYPE_UBIGINT, 15, LONG_BYTES, "BIGINT UNSIGNED", 0, UINT64_MAX, tsCompressBigint, tsDecompressBigint,
|
||||
getStatics_u64},
|
||||
};
|
||||
|
||||
char tTokenTypeSwitcher[13] = {
|
||||
|
@ -425,9 +431,7 @@ FORCE_INLINE void* getDataMax(int32_t type) {
|
|||
}
|
||||
}
|
||||
|
||||
bool isValidDataType(int32_t type) {
|
||||
return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_UBIGINT;
|
||||
}
|
||||
bool isValidDataType(int32_t type) { return type >= TSDB_DATA_TYPE_NULL && type <= TSDB_DATA_TYPE_UBIGINT; }
|
||||
|
||||
void setVardataNull(void *val, int32_t type) {
|
||||
if (type == TSDB_DATA_TYPE_BINARY) {
|
||||
|
@ -533,9 +537,8 @@ static SBinaryNullT nullBinary = {1, TSDB_DATA_BINARY_NULL};
|
|||
static SNCharNullT nullNchar = {4, TSDB_DATA_NCHAR_NULL};
|
||||
|
||||
static const void *nullValues[] = {
|
||||
&nullBool, &nullTinyInt, &nullSmallInt, &nullInt, &nullBigInt,
|
||||
&nullFloat, &nullDouble, &nullBinary, &nullBigInt, &nullNchar,
|
||||
&nullTinyIntu, &nullSmallIntu, &nullIntu, &nullBigIntu,
|
||||
&nullBool, &nullTinyInt, &nullSmallInt, &nullInt, &nullBigInt, &nullFloat, &nullDouble,
|
||||
&nullBinary, &nullBigInt, &nullNchar, &nullTinyIntu, &nullSmallIntu, &nullIntu, &nullBigIntu,
|
||||
};
|
||||
|
||||
const void *getNullValue(int32_t type) {
|
||||
|
|
|
@ -263,7 +263,6 @@ void taosVariantAssign(SVariant *pDst, const SVariant *pSrc) {
|
|||
memcpy(pDst->pz, pSrc->pz, pSrc->nLen);
|
||||
pDst->nLen = pSrc->nLen;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (IS_NUMERIC_TYPE(pSrc->nType) || (pSrc->nType == TSDB_DATA_TYPE_BOOL)) {
|
||||
|
@ -507,7 +506,8 @@ static FORCE_INLINE int32_t convertToDouble(char *pStr, int32_t len, double *val
|
|||
return 0;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result, int32_t type, bool issigned, bool releaseVariantPtr, bool *converted) {
|
||||
static FORCE_INLINE int32_t convertToInteger(SVariant *pVariant, int64_t *result, int32_t type, bool issigned,
|
||||
bool releaseVariantPtr, bool *converted) {
|
||||
if (pVariant->nType == TSDB_DATA_TYPE_NULL) {
|
||||
setNull((char *)result, type, tDataTypes[type].bytes);
|
||||
return 0;
|
||||
|
@ -665,7 +665,8 @@ static int32_t convertToBool(SVariant *pVariant, int64_t *pDest) {
|
|||
* transfer data from variant serve as the implicit data conversion: from input sql string pVariant->nType
|
||||
* to column type defined in schema
|
||||
*/
|
||||
int32_t tVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool includeLengthPrefix, bool *converted, char *extInfo) {
|
||||
int32_t tVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool includeLengthPrefix, bool *converted,
|
||||
char *extInfo) {
|
||||
if (converted) {
|
||||
*converted = false;
|
||||
}
|
||||
|
@ -782,7 +783,8 @@ int32_t tVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool inc
|
|||
}
|
||||
SET_FLOAT_VAL(payload, value);
|
||||
}
|
||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(pVariant->nType) || IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) {
|
||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(pVariant->nType) ||
|
||||
IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) {
|
||||
if (converted) {
|
||||
*converted = true;
|
||||
}
|
||||
|
@ -831,7 +833,8 @@ int32_t tVariantDumpEx(SVariant *pVariant, char *payload, int16_t type, bool inc
|
|||
|
||||
SET_DOUBLE_VAL(payload, value);
|
||||
}
|
||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(pVariant->nType) || IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) {
|
||||
} else if (pVariant->nType == TSDB_DATA_TYPE_BOOL || IS_SIGNED_NUMERIC_TYPE(pVariant->nType) ||
|
||||
IS_UNSIGNED_NUMERIC_TYPE(pVariant->nType)) {
|
||||
SET_DOUBLE_VAL(payload, pVariant->i);
|
||||
} else if (IS_FLOAT_TYPE(pVariant->nType)) {
|
||||
SET_DOUBLE_VAL(payload, pVariant->d);
|
||||
|
|
Loading…
Reference in New Issue