diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index 6ca4327c96bbd38cefb18277daff079809c21b7f..78a2a8b29b19f59ab77ee947e4551392d8b94323 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -4094,7 +4094,7 @@ int32_t generateGroupIdMap(STableListInfo* pTableListInfo, SReadHandle* pHandle, ASSERT(nodeType(pNew) == QUERY_NODE_VALUE); SValueNode* pValue = (SValueNode*)pNew; - if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL) { + if (pValue->node.resType.type == TSDB_DATA_TYPE_NULL || pValue->isNull) { isNull[index++] = 1; continue; } else { diff --git a/source/libs/scalar/src/filter.c b/source/libs/scalar/src/filter.c index 42be99d08b78f68368eada83106475f1f4dd3bda..a7f66ebb7d519ff9763ab77d9ebd98fb4d6256b3 100644 --- a/source/libs/scalar/src/filter.c +++ b/source/libs/scalar/src/filter.c @@ -196,7 +196,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { terrno = TSDB_CODE_QRY_JSON_IN_ERROR; return 0; default: - assert(0); + return 0; } } @@ -222,7 +222,7 @@ int8_t filterGetCompFuncIdx(int32_t type, int32_t optr) { terrno = TSDB_CODE_QRY_JSON_IN_ERROR; return 0; default: - assert(0); + return 0; } } diff --git a/source/libs/scalar/src/scalar.c b/source/libs/scalar/src/scalar.c index d093c8bdbd505bfac393f913d872b47ffc4a569c..cf4701ced805ae666a4865538966f31ae4616478 100644 --- a/source/libs/scalar/src/scalar.c +++ b/source/libs/scalar/src/scalar.c @@ -194,7 +194,7 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t param->numOfRows = 1; param->columnData = sclCreateColumnInfoData(&valueNode->node.resType, 1); - if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type) { + if (TSDB_DATA_TYPE_NULL == valueNode->node.resType.type || valueNode->isNull) { colDataAppendNULL(param->columnData, 0); } else { colDataAppend(param->columnData, 0, nodesGetValueFromNode(valueNode), false); @@ -538,6 +538,14 @@ int32_t sclExecOperator(SOperatorNode *node, SScalarCtx *ctx, SScalarParam *outp int32_t rowNum = 0; int32_t code = 0; + // json not support in in operator + if(nodeType(node->pLeft) == QUERY_NODE_VALUE){ + SValueNode *valueNode = (SValueNode *)node->pLeft; + if(valueNode->node.resType.type == TSDB_DATA_TYPE_JSON && (node->opType == OP_TYPE_IN || node->opType == OP_TYPE_NOT_IN)){ + SCL_RET(TSDB_CODE_QRY_JSON_IN_ERROR); + } + } + SCL_ERR_RET(sclInitOperatorParams(¶ms, node, ctx, &rowNum)); output->columnData = sclCreateColumnInfoData(&node->node.resType, rowNum); if (output->columnData == NULL) { @@ -777,7 +785,12 @@ EDealRes sclRewriteOperator(SNode** pNode, SScalarCtx *ctx) { res->translate = true; if (colDataIsNull_s(output.columnData, 0)) { - res->node.resType.type = TSDB_DATA_TYPE_NULL; + if(node->node.resType.type != TSDB_DATA_TYPE_JSON){ + res->node.resType.type = TSDB_DATA_TYPE_NULL; + }else{ + res->node.resType = node->node.resType; + res->isNull = true; + } } else { res->node.resType = node->node.resType; int32_t type = output.columnData->info.type;