From 26196b6ba38ffb68e1353ac03c6ab33e0ebe63ca Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Mon, 13 Dec 2021 10:07:53 +0800 Subject: [PATCH] code optimization for input from csv --- src/client/src/tscParseInsert.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index d14863321f..f2ec5da5c4 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -1749,7 +1749,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow } int32_t extendedRowSize = getExtendedRowSize(pTableDataBlock); - tscAllocateMemIfNeed(pTableDataBlock, extendedRowSize, &maxRows); tokenBuf = calloc(1, TSDB_MAX_BYTES_PER_ROW); if (tokenBuf == NULL) { @@ -1757,9 +1756,9 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow goto _error; } - --maxRows; // 1 more row needed to facilitate the SDataRow/SKVRow convert - ASSERT(maxRows > 0); - + // insert from .csv means full and ordered columns, thus use SDataRow all the time and no need to covert + ASSERT(SMEM_ROW_DATA == pTableDataBlock->rowBuilder.memRowType && + ROW_COMPARE_NO_NEED == pTableDataBlock->rowBuilder.compareStat); int32_t convertOffset = 0; while ((readLen = tgetline(&line, &n, fp)) != -1) { if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { @@ -1786,10 +1785,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow break; } } - if (convertOffset) { - char *convertedSMemRow = pTableDataBlock->pData + pTableDataBlock->size; - memcpy(convertedSMemRow - convertOffset * extendedRowSize, convertedSMemRow, (size_t)memRowTLen(convertedSMemRow)); - } tfree(tokenBuf); tfree(line); -- GitLab