提交 44dcaf25 编写于 作者: D dapan1121

fix: fix type convertion issue

上级 d18e7cd7
...@@ -909,11 +909,11 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut, int32_t* ...@@ -909,11 +909,11 @@ int32_t vectorConvertImpl(const SScalarParam* pIn, SScalarParam* pOut, int32_t*
int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB+1][TSDB_DATA_TYPE_BLOB+1] = { int8_t gConvertTypes[TSDB_DATA_TYPE_BLOB+1][TSDB_DATA_TYPE_BLOB+1] = {
/* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */ /* NULL BOOL TINY SMAL INT BIG FLOA DOUB VARC TIME NCHA UTIN USMA UINT UBIG JSON VARB DECI BLOB */
/*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /*NULL*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
/*BOOL*/ 0, 0, 0, 3, 4, 5, 6, 7, 7, 9, 7, 0, 12, 13, 14, 0, 7, 0, 0, /*BOOL*/ 0, 0, 2, 3, 4, 5, 6, 7, 7, 9, 7, 11, 12, 13, 14, 0, 7, 0, 0,
/*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, /*TINY*/ 0, 0, 0, 3, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0,
/*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0, /*SMAL*/ 0, 0, 0, 0, 4, 5, 6, 7, 7, 9, 7, 3, 4, 5, 7, 0, 7, 0, 0,
/*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 7, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0, /*INT */ 0, 0, 0, 0, 0, 5, 6, 7, 7, 9, 7, 4, 4, 5, 7, 0, 7, 0, 0,
/*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 5, 5, 5, 7, 0, 7, 0, 0, /*BIGI*/ 0, 0, 0, 0, 0, 0, 6, 7, 7, 9, 7, 5, 5, 5, 7, 0, 7, 0, 0,
/*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0, /*FLOA*/ 0, 0, 0, 0, 0, 0, 0, 7, 7, 6, 7, 6, 6, 6, 6, 0, 7, 0, 0,
/*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, /*DOUB*/ 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0,
/*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0, /*VARC*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 8, 7, 7, 7, 7, 0, 0, 0, 0,
......
...@@ -570,9 +570,23 @@ int32_t compareFloatInt64(const void *pLeft, const void *pRight) { ...@@ -570,9 +570,23 @@ int32_t compareFloatInt64(const void *pLeft, const void *pRight) {
int32_t compareFloatDouble(const void *pLeft, const void *pRight) { int32_t compareFloatDouble(const void *pLeft, const void *pRight) {
float left = GET_FLOAT_VAL(pLeft); float left = GET_FLOAT_VAL(pLeft);
double right = GET_DOUBLE_VAL(pRight); double right = GET_DOUBLE_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1; if (isnan(left) && isnan(right)) {
return 0; return 0;
}
if (isnan(left)) {
return -1;
}
if (isnan(right)) {
return 1;
}
if (FLT_EQUAL(left, right)) {
return 0;
}
return FLT_GREATER(left, right) ? 1 : -1;
} }
int32_t compareFloatUint8(const void *pLeft, const void *pRight) { int32_t compareFloatUint8(const void *pLeft, const void *pRight) {
...@@ -642,9 +656,23 @@ int32_t compareDoubleInt64(const void *pLeft, const void *pRight) { ...@@ -642,9 +656,23 @@ int32_t compareDoubleInt64(const void *pLeft, const void *pRight) {
int32_t compareDoubleFloat(const void *pLeft, const void *pRight) { int32_t compareDoubleFloat(const void *pLeft, const void *pRight) {
double left = GET_DOUBLE_VAL(pLeft); double left = GET_DOUBLE_VAL(pLeft);
float right = GET_FLOAT_VAL(pRight); float right = GET_FLOAT_VAL(pRight);
if (left > right) return 1;
if (left < right) return -1; if (isnan(left) && isnan(right)) {
return 0; return 0;
}
if (isnan(left)) {
return -1;
}
if (isnan(right)) {
return 1;
}
if (FLT_EQUAL(left, right)) {
return 0;
}
return FLT_GREATER(left, right) ? 1 : -1;
} }
int32_t compareDoubleUint8(const void *pLeft, const void *pRight) { int32_t compareDoubleUint8(const void *pLeft, const void *pRight) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册