From 319d2785abd24ec3ca82af084d2990258bf79027 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 5 May 2022 18:33:31 +0800 Subject: [PATCH] feat: update support merge in mem --- source/dnode/vnode/src/tsdb/tsdbRead.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/dnode/vnode/src/tsdb/tsdbRead.c b/source/dnode/vnode/src/tsdb/tsdbRead.c index 72fada4e97..7f733e0e4b 100644 --- a/source/dnode/vnode/src/tsdb/tsdbRead.c +++ b/source/dnode/vnode/src/tsdb/tsdbRead.c @@ -1613,6 +1613,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa SCellVal sVal = {0}; TSKEY rowKey = TSKEY_INITIAL_VAL; int32_t nResult = 0; + bool isMerge = true; // the schema version info is embeded in STSRow int32_t numOfColsOfRow1 = 0; @@ -1708,6 +1709,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { rowKey = *(TSKEY*)sVal.val; if (rowKey != *lastRowKey) { + isMerge = false; if (*lastRowKey != TSKEY_INITIAL_VAL) { ++(*curRow); } @@ -1722,6 +1724,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa tdSKvRowGetVal(row, PRIMARYKEY_TIMESTAMP_COL_ID, -1, -1, &sVal); rowKey = *(TSKEY*)sVal.val; if (rowKey != *lastRowKey) { + isMerge = false; if (*lastRowKey != TSKEY_INITIAL_VAL) { ++(*curRow); } @@ -1745,7 +1748,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa colDataAppend(pColInfo, *curRow, NULL, true); } else if (tdValTypeIsNone(sVal.valType)) { // TODO: Set null if nothing append for this row - if (*lastRowKey != rowKey) { + if (!isMerge) { colDataAppend(pColInfo, *curRow, NULL, true); } } else { @@ -1760,7 +1763,7 @@ static int32_t mergeTwoRowFromMem(STsdbReadHandle* pTsdbReadHandle, int32_t capa ++k; } } else { - if (*lastRowKey != rowKey) { + if (!isMerge) { colDataAppend(pColInfo, *curRow, NULL, true); } ++i;