提交 ad00bcd4 编写于 作者: C Cary Xu

code optimization for input from csv

上级 2e1395fa
...@@ -1781,7 +1781,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow ...@@ -1781,7 +1781,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
} }
int32_t extendedRowSize = getExtendedRowSize(pTableDataBlock); int32_t extendedRowSize = getExtendedRowSize(pTableDataBlock);
tscAllocateMemIfNeed(pTableDataBlock, extendedRowSize, &maxRows); tscAllocateMemIfNeed(pTableDataBlock, extendedRowSize, &maxRows);
tokenBuf = calloc(1, TSDB_MAX_BYTES_PER_ROW); tokenBuf = calloc(1, TSDB_MAX_BYTES_PER_ROW);
if (tokenBuf == NULL) { if (tokenBuf == NULL) {
...@@ -1789,9 +1788,9 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow ...@@ -1789,9 +1788,9 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
goto _error; goto _error;
} }
--maxRows; // 1 more row needed to facilitate the SDataRow/SKVRow convert // insert from .csv means full and ordered columns, thus use SDataRow all the time and no need to covert
ASSERT(maxRows > 0); ASSERT(SMEM_ROW_DATA == pTableDataBlock->rowBuilder.memRowType &&
ROW_COMPARE_NO_NEED == pTableDataBlock->rowBuilder.compareStat);
int32_t convertOffset = 0; int32_t convertOffset = 0;
while ((readLen = tgetline(&line, &n, fp)) != -1) { while ((readLen = tgetline(&line, &n, fp)) != -1) {
if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) { if (('\r' == line[readLen - 1]) || ('\n' == line[readLen - 1])) {
...@@ -1818,10 +1817,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow ...@@ -1818,10 +1817,6 @@ static void parseFileSendDataBlock(void *param, TAOS_RES *tres, int32_t numOfRow
break; break;
} }
} }
if (convertOffset) {
char *convertedSMemRow = pTableDataBlock->pData + pTableDataBlock->size;
memcpy(convertedSMemRow - convertOffset * extendedRowSize, convertedSMemRow, (size_t)memRowTLen(convertedSMemRow));
}
tfree(tokenBuf); tfree(tokenBuf);
tfree(line); tfree(line);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册