From 6fb22fdc8388df1281e5d8ff467c215d1cd2e035 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Mon, 11 May 2020 12:18:56 +0800 Subject: [PATCH] [td-225] --- src/tsdb/src/tsdbRead.c | 6 +++++- tests/script/general/parser/lastrow_query.sim | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index cbb128045e..2f0bc3ecc8 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -620,9 +620,13 @@ static void filterDataInDataBlock(STsdbQueryHandle* pQueryHandle, STableCheckInf if (pCol->info.type != TSDB_DATA_TYPE_BINARY && pCol->info.type != TSDB_DATA_TYPE_NCHAR) { memmove(pCol->pData, src->pData + bytes * start, bytes * pQueryHandle->realNumOfRows); } else { // handle the var-string + char* dst = pCol->pData; + + // todo refactor, only copy one-by-one for(int32_t k = start; k < pQueryHandle->realNumOfRows + start; ++k) { char* p = tdGetColDataOfRow(src, k); - memcpy(pCol->pData + k * bytes, p, varDataTLen(p)); // todo refactor + memcpy(dst, p, varDataTLen(p)); + dst += varDataTLen(p); } } diff --git a/tests/script/general/parser/lastrow_query.sim b/tests/script/general/parser/lastrow_query.sim index a5e003fb65..e43cc15173 100644 --- a/tests/script/general/parser/lastrow_query.sim +++ b/tests/script/general/parser/lastrow_query.sim @@ -43,9 +43,11 @@ if $data07 != 1 then return -1 endi if $data08 != BINARY then + print expect BINARY actual: $data08 return -1 endi if $data09 != NCHAR then + print expect NCHAR actual: $data09 return -1 endi -- GitLab