未验证 提交 424e1323 编写于 作者: H haojun Liao 提交者: GitHub

Merge pull request #5464 from taosdata/feature/query

[td-3338]<fix>: query data before 1970-1-1 00:00:00 caused taosd crash.
......@@ -1021,6 +1021,14 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
pBlock->numOfRows = pCols->numOfRows;
// Convert from TKEY to TSKEY for primary timestamp column if current block has timestamp before 1970-01-01T00:00:00Z
if(pBlock->keyFirst < 0 && colIds[0] == PRIMARYKEY_TIMESTAMP_COL_INDEX) {
int64_t* src = pCols->cols[0].pData;
for(int32_t i = 0; i < pBlock->numOfRows; ++i) {
src[i] = tdGetKey(src[i]);
}
}
int64_t elapsedTime = (taosGetTimestampUs() - st);
pQueryHandle->cost.blockLoadTime += elapsedTime;
......@@ -1277,13 +1285,7 @@ int32_t doCopyRowsFromFileBlock(STsdbQueryHandle* pQueryHandle, int32_t capacity
}
if (pColInfo->info.colId == src->colId) {
if (pColInfo->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
for (int32_t n = 0; n < num; n++) {
TKEY tkey = *(TKEY *)((char*)src->pData + bytes * start + n * sizeof(TKEY));
*(TSKEY *)(pData + n * sizeof(TSKEY)) = tdGetKey(tkey);
}
} else if (pColInfo->info.type != TSDB_DATA_TYPE_BINARY && pColInfo->info.type != TSDB_DATA_TYPE_NCHAR) {
if (pColInfo->info.type != TSDB_DATA_TYPE_BINARY && pColInfo->info.type != TSDB_DATA_TYPE_NCHAR) {
memmove(pData, (char*)src->pData + bytes * start, bytes * num);
} else { // handle the var-string
char* dst = pData;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册