[td-13039] fix bug in scalar filter.
This commit is contained in:
parent
400989c040
commit
d4fa582040
|
@ -1795,6 +1795,7 @@ int32_t fltInitValFieldData(SFilterInfo *info) {
|
||||||
SScalarParam out = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
SScalarParam out = {.columnData = calloc(1, sizeof(SColumnInfoData))};
|
||||||
out.columnData->info.type = type;
|
out.columnData->info.type = type;
|
||||||
|
|
||||||
|
// todo refactor the convert
|
||||||
int32_t code = doConvertDataType(&in, &out, var);
|
int32_t code = doConvertDataType(&in, &out, var);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("convert value to type[%d] failed", type);
|
qError("convert value to type[%d] failed", type);
|
||||||
|
|
|
@ -41,7 +41,9 @@ SColumnInfoData* createColumnInfoData(SDataType* pType, int32_t numOfRows) {
|
||||||
int32_t doConvertDataType(SScalarParam* in, SScalarParam* out, SValueNode* pValueNode) {
|
int32_t doConvertDataType(SScalarParam* in, SScalarParam* out, SValueNode* pValueNode) {
|
||||||
in->columnData = createColumnInfoData(&pValueNode->node.resType, 1);
|
in->columnData = createColumnInfoData(&pValueNode->node.resType, 1);
|
||||||
colDataAppend(in->columnData, 0, nodesGetValueFromNode(pValueNode), false);
|
colDataAppend(in->columnData, 0, nodesGetValueFromNode(pValueNode), false);
|
||||||
|
in->numOfRows = 1;
|
||||||
|
|
||||||
|
blockDataEnsureColumnCapacity(out->columnData, 1);
|
||||||
return vectorConvertImpl(in, out);
|
return vectorConvertImpl(in, out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +69,9 @@ int32_t scalarGenerateSetFromList(void **data, void *pNode, uint32_t type) {
|
||||||
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
SValueNode *valueNode = (SValueNode *)cell->pNode;
|
||||||
|
|
||||||
if (valueNode->node.resType.type != type) {
|
if (valueNode->node.resType.type != type) {
|
||||||
|
out.columnData->info.type = type;
|
||||||
|
out.columnData->info.bytes = tDataTypes[type].bytes;
|
||||||
|
|
||||||
doConvertDataType(&in, &out, valueNode);
|
doConvertDataType(&in, &out, valueNode);
|
||||||
if (code) {
|
if (code) {
|
||||||
// sclError("convert data from %d to %d failed", in.type, out.type);
|
// sclError("convert data from %d to %d failed", in.type, out.type);
|
||||||
|
@ -167,8 +172,8 @@ int32_t sclInitParam(SNode* node, SScalarParam *param, SScalarCtx *ctx, int32_t
|
||||||
|
|
||||||
case QUERY_NODE_NODE_LIST: {
|
case QUERY_NODE_NODE_LIST: {
|
||||||
SNodeListNode *nodeList = (SNodeListNode *)node;
|
SNodeListNode *nodeList = (SNodeListNode *)node;
|
||||||
if (nodeList->pNodeList->length <= 0) {
|
if (LIST_LENGTH(nodeList->pNodeList) <= 0) {
|
||||||
sclError("invalid length in nodeList, length:%d", nodeList->pNodeList->length);
|
sclError("invalid length in nodeList, length:%d", LIST_LENGTH(nodeList->pNodeList));
|
||||||
SCL_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
SCL_RET(TSDB_CODE_QRY_INVALID_INPUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue