feat: add sort/group logic for json
This commit is contained in:
parent
17ea0e489a
commit
9e1cd759f3
|
@ -71,20 +71,14 @@ SEpSet getEpSet_s(SCorEpSet* pEpSet);
|
|||
#define colDataGetData(p1_, r_) \
|
||||
((IS_VAR_DATA_TYPE((p1_)->info.type)) ? colDataGetVarData(p1_, r_) : colDataGetNumData(p1_, r_))
|
||||
|
||||
static FORCE_INLINE bool colDataIsNull_s(const SColumnInfoData* pColumnInfoData, uint32_t row) {
|
||||
if (pColumnInfoData->info.type == TSDB_DATA_TYPE_JSON) {
|
||||
if (colDataIsNull_var(pColumnInfoData, row)) {
|
||||
return true;
|
||||
}
|
||||
char* data = colDataGetVarData(pColumnInfoData, row);
|
||||
return (*data == TSDB_DATA_TYPE_NULL);
|
||||
}
|
||||
#define IS_JSON_NULL(type,data) ((type) == TSDB_DATA_TYPE_JSON && *(data) == TSDB_DATA_TYPE_NULL)
|
||||
|
||||
static FORCE_INLINE bool colDataIsNull_s(const SColumnInfoData* pColumnInfoData, uint32_t row) {
|
||||
if (!pColumnInfoData->hasNull) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pColumnInfoData->info.type == TSDB_DATA_TYPE_VARCHAR || pColumnInfoData->info.type == TSDB_DATA_TYPE_NCHAR) {
|
||||
if (IS_VAR_DATA_TYPE(pColumnInfoData->info.type)) {
|
||||
return colDataIsNull_var(pColumnInfoData, row);
|
||||
} else {
|
||||
if (pColumnInfoData->nullbitmap == NULL) {
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#define LEFT_COL ((pLeftCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pLeftCol : pLeftCol->pData))
|
||||
#define RIGHT_COL ((pRightCol->info.type == TSDB_DATA_TYPE_JSON ? (void*)pRightCol : pRightCol->pData))
|
||||
|
||||
#define IS_NULL colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i) \
|
||||
|| IS_JSON_NULL(pLeft->columnData->info.type, colDataGetVarData(pLeft->columnData, i)) \
|
||||
|| IS_JSON_NULL(pRight->columnData->info.type, colDataGetVarData(pRight->columnData, i))
|
||||
|
||||
#define IS_HELPER_NULL(col,i) colDataIsNull_s(col, i) || IS_JSON_NULL(col->info.type, colDataGetVarData(col, i))
|
||||
|
||||
void convertNumberToNumber(const void *inData, void *outData, int8_t inType, int8_t outType){
|
||||
switch (outType) {
|
||||
case TSDB_DATA_TYPE_BOOL: {
|
||||
|
@ -867,11 +873,11 @@ static void vectorMathAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -887,11 +893,11 @@ static void vectorMathBigintAddHelper(SColumnInfoData* pLeftCol, SColumnInfoData
|
|||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -982,7 +988,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1000,7 +1006,7 @@ void vectorMathAdd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL){
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1024,11 +1030,11 @@ static void vectorMathSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRig
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1044,11 +1050,11 @@ static void vectorMathBigintSubHelper(SColumnInfoData* pLeftCol, SColumnInfoData
|
|||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1077,7 +1083,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1095,7 +1101,7 @@ void vectorMathSub(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1119,11 +1125,11 @@ static void vectorMathMultiplyHelper(SColumnInfoData* pLeftCol, SColumnInfoData*
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_f(pRightCol->nullbitmap, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1149,7 +1155,7 @@ void vectorMathMultiply(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
|
|||
double *output = (double *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1182,7 +1188,7 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
|
|||
double *output = (double *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i) || (getVectorDoubleValueFnRight(RIGHT_COL, i) == 0)) { //divide by 0 check
|
||||
if (IS_NULL || (getVectorDoubleValueFnRight(RIGHT_COL, i) == 0)) { //divide by 0 check
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1190,11 +1196,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
|
|||
/ getVectorDoubleValueFnRight(RIGHT_COL, i);
|
||||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
if (colDataIsNull_s(pLeftCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pLeftCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, pRight->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pRightCol, i) || (getVectorDoubleValueFnRight(RIGHT_COL, i) == 0)) { // divide by 0 check
|
||||
if (IS_HELPER_NULL(pRightCol, i) || (getVectorDoubleValueFnRight(RIGHT_COL, i) == 0)) { // divide by 0 check
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1203,11 +1209,11 @@ void vectorMathDivide(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *p
|
|||
}
|
||||
}
|
||||
} else if (pRight->numOfRows == 1) {
|
||||
if (colDataIsNull_s(pRightCol, 0) || (getVectorDoubleValueFnRight(RIGHT_COL, 0) == 0)) { // Set pLeft->numOfRows NULL value (divde by 0 check)
|
||||
if (IS_HELPER_NULL(pRightCol, 0) || (getVectorDoubleValueFnRight(RIGHT_COL, 0) == 0)) { // Set pLeft->numOfRows NULL value (divde by 0 check)
|
||||
colDataAppendNNULL(pOutputCol, 0, pLeft->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1240,7 +1246,7 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i) || colDataIsNull_s(pRightCol, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1256,11 +1262,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
|
|||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
double lx = getVectorDoubleValueFnLeft(LEFT_COL, 0);
|
||||
if (colDataIsNull_s(pLeftCol, 0) || isnan(lx) || isinf(lx)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pLeftCol, 0) || isnan(lx) || isinf(lx)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, pRight->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pRight->numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pRightCol, i)) {
|
||||
if (IS_HELPER_NULL(pRightCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1276,11 +1282,11 @@ void vectorMathRemainder(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
|
|||
}
|
||||
} else if (pRight->numOfRows == 1) {
|
||||
double rx = getVectorDoubleValueFnRight(RIGHT_COL, 0);
|
||||
if (colDataIsNull_s(pRightCol, 0) || FLT_EQUAL(rx, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0) || FLT_EQUAL(rx, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, pLeft->numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1315,7 +1321,7 @@ void vectorMathMinus(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pO
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
for (; i < pLeft->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue;
|
||||
}
|
||||
|
@ -1331,7 +1337,7 @@ void vectorAssign(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
|
|||
|
||||
pOut->numOfRows = pLeft->numOfRows;
|
||||
|
||||
if (colDataIsNull_s(pRight->columnData, 0)) {
|
||||
if (IS_HELPER_NULL(pRight->columnData, 0)) {
|
||||
for (int32_t i = 0; i < pOut->numOfRows; ++i) {
|
||||
colDataAppend(pOutputCol, i, NULL, true);
|
||||
}
|
||||
|
@ -1399,11 +1405,11 @@ static void vectorBitAndHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRigh
|
|||
|
||||
double *output = (double *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_s(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1429,7 +1435,7 @@ void vectorBitAnd(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
|
|||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1451,12 +1457,12 @@ static void vectorBitOrHelper(SColumnInfoData* pLeftCol, SColumnInfoData* pRight
|
|||
|
||||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
|
||||
if (colDataIsNull_s(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
if (IS_HELPER_NULL(pRightCol, 0)) { // Set pLeft->numOfRows NULL value
|
||||
colDataAppendNNULL(pOutputCol, 0, numOfRows);
|
||||
} else {
|
||||
int64_t rx = getVectorBigintValueFnRight(RIGHT_COL, 0);
|
||||
for (; i >= 0 && i < numOfRows; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeftCol, i)) {
|
||||
if (IS_HELPER_NULL(pLeftCol, i)) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1482,7 +1488,7 @@ void vectorBitOr(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
|
|||
int64_t *output = (int64_t *)pOutputCol->pData;
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step, output += 1) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_NULL) {
|
||||
colDataAppendNULL(pOutputCol, i);
|
||||
continue; // TODO set null or ignore
|
||||
}
|
||||
|
@ -1507,7 +1513,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
|
||||
if (pRight->pHashFilter != NULL) {
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i)) {
|
||||
if (IS_HELPER_NULL(pLeft->columnData, i)) {
|
||||
bool res = false;
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
continue;
|
||||
|
@ -1522,7 +1528,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
|
||||
if (pLeft->numOfRows == pRight->numOfRows) {
|
||||
for (; i < pRight->numOfRows && i >= 0; i += step) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, i)) {
|
||||
if (IS_HELPER_NULL(pLeft->columnData, i) || IS_HELPER_NULL(pRight->columnData, i)) {
|
||||
bool res = false;
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
continue; // TODO set null or ignore
|
||||
|
@ -1536,8 +1542,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
bool isJsonnull = false;
|
||||
convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull);
|
||||
if(isJsonnull){
|
||||
colDataAppendNULL(pOut->columnData, i);
|
||||
continue; // TODO set null or ignore
|
||||
ASSERT(0);
|
||||
}
|
||||
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
|
@ -1545,7 +1550,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
} else if (pRight->numOfRows == 1) {
|
||||
ASSERT(pLeft->pHashFilter == NULL);
|
||||
for (; i >= 0 && i < pLeft->numOfRows; i += step) {
|
||||
if (colDataIsNull_s(pLeft->columnData, i) || colDataIsNull_s(pRight->columnData, 0)) {
|
||||
if (IS_HELPER_NULL(pLeft->columnData, i) || IS_HELPER_NULL(pRight->columnData, 0)) {
|
||||
bool res = false;
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
continue;
|
||||
|
@ -1558,15 +1563,14 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
bool isJsonnull = false;
|
||||
convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull);
|
||||
if(isJsonnull){
|
||||
colDataAppendNULL(pOut->columnData, i);
|
||||
continue; // TODO set null or ignore
|
||||
ASSERT(0);
|
||||
}
|
||||
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
}
|
||||
} else if (pLeft->numOfRows == 1) {
|
||||
for (; i >= 0 && i < pRight->numOfRows; i += step) {
|
||||
if (colDataIsNull_s(pRight->columnData, i) || colDataIsNull_s(pLeft->columnData, 0)) {
|
||||
if (IS_HELPER_NULL(pRight->columnData, i) || IS_HELPER_NULL(pLeft->columnData, 0)) {
|
||||
bool res = false;
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
continue;
|
||||
|
@ -1579,8 +1583,7 @@ void vectorCompareImpl(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *
|
|||
bool isJsonnull = false;
|
||||
convertJsonValue(&fp, optr, GET_PARAM_TYPE(pLeft), GET_PARAM_TYPE(pRight), &pLeftData, &pRightData, &leftOut, &rightOut, &isJsonnull);
|
||||
if(isJsonnull){
|
||||
colDataAppendNULL(pOut->columnData, i);
|
||||
continue; // TODO set null or ignore
|
||||
ASSERT(0);
|
||||
}
|
||||
bool res = filterDoCompare(fp, optr, pLeftData, pRightData);
|
||||
colDataAppendInt8(pOut->columnData, i, (int8_t*)&res);
|
||||
|
@ -1668,7 +1671,7 @@ void vectorJsonContains(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam
|
|||
|
||||
void vectorIsNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
||||
for(int32_t i = 0; i < pLeft->numOfRows; ++i) {
|
||||
int8_t v = colDataIsNull_s(pLeft->columnData, i)? 1:0;
|
||||
int8_t v = IS_HELPER_NULL(pLeft->columnData, i) ? 1 : 0;
|
||||
colDataAppendInt8(pOut->columnData, i, &v);
|
||||
}
|
||||
pOut->numOfRows = pLeft->numOfRows;
|
||||
|
@ -1676,7 +1679,7 @@ void vectorIsNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut,
|
|||
|
||||
void vectorNotNull(SScalarParam* pLeft, SScalarParam* pRight, SScalarParam *pOut, int32_t _ord) {
|
||||
for(int32_t i = 0; i < pLeft->numOfRows; ++i) {
|
||||
int8_t v = colDataIsNull_s(pLeft->columnData, i)? 0:1;
|
||||
int8_t v = IS_HELPER_NULL(pLeft->columnData, i) ? 0 : 1;
|
||||
colDataAppendInt8(pOut->columnData, i, &v);
|
||||
}
|
||||
pOut->numOfRows = pLeft->numOfRows;
|
||||
|
|
|
@ -1227,7 +1227,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
printf("--------------------json null---------------------\n");
|
||||
|
||||
key = "k3"; // (null is true) return NULL, so use DBL_MAX represent NULL
|
||||
double eRes2[len+len1] = {false, false, false, false, false, false, true, false, DBL_MAX, false, false, false, false};
|
||||
double eRes2[len+len1] = {false, false, false, false, false, false, true, false, false, false, false, false, false};
|
||||
for(int i = 0; i < len; i++){
|
||||
makeCalculate(row, key, TSDB_DATA_TYPE_INT, &input[i], eRes2[i], op[i]);
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ TEST(columnTest, json_column_logic_op) {
|
|||
printf("---------------------json not exist--------------------\n");
|
||||
|
||||
key = "k10"; // (NULL is true) return NULL, so use DBL_MAX represent NULL
|
||||
double eRes10[len+len1] = {false, false, false, false, false, false, true, false, DBL_MAX, false, false, false, false};
|
||||
double eRes10[len+len1] = {false, false, false, false, false, false, true, false, false, false, false, false, false};
|
||||
for(int i = 0; i < len; i++){
|
||||
makeCalculate(row, key, TSDB_DATA_TYPE_INT, &input[i], eRes10[i], op[i]);
|
||||
}
|
||||
|
|
|
@ -137,9 +137,9 @@ class TDTestCase:
|
|||
tdSql.checkRows(9)
|
||||
tdSql.query("select jtag from jsons1")
|
||||
tdSql.checkRows(13)
|
||||
# tdSql.query("select jtag from jsons1 where jtag is null")
|
||||
tdSql.query("select jtag from jsons1 where jtag is null")
|
||||
# tdSql.checkRows(5)
|
||||
# tdSql.query("select jtag from jsons1 where jtag is not null")
|
||||
tdSql.query("select jtag from jsons1 where jtag is not null")
|
||||
# tdSql.checkRows(8)
|
||||
|
||||
# test jtag is NULL
|
||||
|
@ -260,9 +260,9 @@ class TDTestCase:
|
|||
# tdSql.checkRows(1)
|
||||
#
|
||||
# # where json is null
|
||||
# tdSql.query("select * from jsons1 where jtag is null")
|
||||
tdSql.query("select * from jsons1 where jtag is null")
|
||||
# tdSql.checkRows(1)
|
||||
# tdSql.query("select * from jsons1 where jtag is not null")
|
||||
tdSql.query("select * from jsons1 where jtag is not null")
|
||||
# tdSql.checkRows(8)
|
||||
#
|
||||
# # where json key is null
|
||||
|
|
Loading…
Reference in New Issue