diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 71c5df6a09..63bb3637cf 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -737,7 +737,7 @@ static int32_t doConvertUCS4(SReqResultInfo* pResultInfo, int32_t numOfRows, int int32_t type = pResultInfo->fields[i].type; int32_t bytes = pResultInfo->fields[i].bytes; - if (type == TSDB_DATA_TYPE_NCHAR) { + if (type == TSDB_DATA_TYPE_NCHAR && colLength[i] > 0) { char* p = taosMemoryRealloc(pResultInfo->convertBuf[i], colLength[i]); if (p == NULL) { return TSDB_CODE_OUT_OF_MEMORY; diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index e308c9c2b9..b81872f20c 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1414,7 +1414,7 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t } if (sVal.valType == TD_VTYPE_NULL) { - colDataAppend(pColInfo, k, NULL, true); + colDataAppendNULL(pColInfo, k); } else { colDataAppend(pColInfo, k, sVal.val, false); } @@ -1427,7 +1427,11 @@ static int32_t doCopyRowsFromFileBlock(STsdbReadHandle* pTsdbReadHandle, int32_t TASSERT(0); } - colDataAppend(pColInfo, k, sVal.val, false); + if (sVal.valType == TD_VTYPE_NULL) { + colDataAppendNULL(pColInfo, k); + } else { + colDataAppend(pColInfo, k, sVal.val, false); + } } } diff --git a/source/libs/executor/src/executorimpl.c b/source/libs/executor/src/executorimpl.c index b86d75cc7b..b7bbb605c5 100644 --- a/source/libs/executor/src/executorimpl.c +++ b/source/libs/executor/src/executorimpl.c @@ -6682,38 +6682,6 @@ bool validateExprColumnInfo(SQueriedTableInfo* pTableInfo, SExprBasicInfo* pExpr return j != INT32_MIN; } -static int32_t deserializeColFilterInfo(SColumnFilterInfo* pColFilters, int16_t numOfFilters, char** pMsg) { - for (int32_t f = 0; f < numOfFilters; ++f) { - SColumnFilterInfo* pFilterMsg = (SColumnFilterInfo*)(*pMsg); - - SColumnFilterInfo* pColFilter = &pColFilters[f]; - pColFilter->filterstr = htons(pFilterMsg->filterstr); - - (*pMsg) += sizeof(SColumnFilterInfo); - - if (pColFilter->filterstr) { - pColFilter->len = htobe64(pFilterMsg->len); - - pColFilter->pz = - (int64_t)taosMemoryCalloc(1, (size_t)(pColFilter->len + 1 * TSDB_NCHAR_SIZE)); // note: null-terminator - if (pColFilter->pz == 0) { - return TSDB_CODE_QRY_OUT_OF_MEMORY; - } - - memcpy((void*)pColFilter->pz, (*pMsg), (size_t)pColFilter->len); - (*pMsg) += (pColFilter->len + 1); - } else { - pColFilter->lowerBndi = htobe64(pFilterMsg->lowerBndi); - pColFilter->upperBndi = htobe64(pFilterMsg->upperBndi); - } - - pColFilter->lowerRelOptr = htons(pFilterMsg->lowerRelOptr); - pColFilter->upperRelOptr = htons(pFilterMsg->upperRelOptr); - } - - return TSDB_CODE_SUCCESS; -} - static SResSchema createResSchema(int32_t type, int32_t bytes, int32_t slotId, int32_t scale, int32_t precision, const char* name) { SResSchema s = {0}; diff --git a/tests/script/tsim/query/diff.sim b/tests/script/tsim/query/diff.sim index ebbd470944..c55b080e44 100644 --- a/tests/script/tsim/query/diff.sim +++ b/tests/script/tsim/query/diff.sim @@ -63,20 +63,21 @@ print =============== step2 $i = 1 $tb = $tbPrefix . $i -print ===> select diff(tbcol) from $tb -sql select diff(tbcol) from $tb +print ===> select _rowts, diff(tbcol) from $tb +sql select _rowts, diff(tbcol) from $tb print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 -if $data11 != 1 then +if $data11 != 1 then + print expect 1, actual: $data11 return -1 endi print =============== step3 $cc = 4 * 60000 $ms = 1601481600000 + $cc -print ===> select diff(tbcol) from $tb where ts > $ms -sql select diff(tbcol) from $tb where ts > $ms +print ===> select _rowts, diff(tbcol) from $tb where ts > $ms +sql select _rowts, diff(tbcol) from $tb where ts > $ms print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 @@ -86,8 +87,8 @@ endi $cc = 4 * 60000 $ms = 1601481600000 + $cc -print ===> select diff(tbcol) from $tb where ts <= $ms -sql select diff(tbcol) from $tb where ts <= $ms +print ===> select _rowts, diff(tbcol) from $tb where ts <= $ms +sql select _rowts, diff(tbcol) from $tb where ts <= $ms print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 @@ -96,8 +97,8 @@ if $data11 != 1 then endi print =============== step4 -print ===> select diff(tbcol) as b from $tb -sql select diff(tbcol) as b from $tb +print ===> select _rowts, diff(tbcol) as b from $tb +sql select _rowts, diff(tbcol) as b from $tb print ===> rows: $rows print ===> $data00 $data01 $data02 $data03 $data04 $data05 print ===> $data10 $data11 $data12 $data13 $data14 $data15 @@ -105,24 +106,24 @@ if $data11 != 1 then return -1 endi -print =============== step5 -print ===> select diff(tbcol) as b from $tb interval(1m) -sql select diff(tbcol) as b from $tb interval(1m) -x step5 - return -1 -step5: - -print =============== step6 -$cc = 4 * 60000 -$ms = 1601481600000 + $cc -print ===> select diff(tbcol) as b from $tb where ts <= $ms interval(1m) -sql select diff(tbcol) as b from $tb where ts <= $ms interval(1m) -x step6 - return -1 +#print =============== step5 +#print ===> select diff(tbcol) as b from $tb interval(1m) +#sql select diff(tbcol) as b from $tb interval(1m) -x step5 +# return -1 +#step5: +# +#print =============== step6 +#$cc = 4 * 60000 +#$ms = 1601481600000 + $cc +#print ===> select diff(tbcol) as b from $tb where ts <= $ms interval(1m) +#sql select diff(tbcol) as b from $tb where ts <= $ms interval(1m) -x step6 +# return -1 step6: print =============== clear sql drop database $db sql show databases -if $rows != 0 then +if $rows != 1 then return -1 endi