Merge pull request #5464 from taosdata/feature/query
[td-3338]<fix>: query data before 1970-1-1 00:00:00 caused taosd crash.
This commit is contained in:
commit
424e132308
|
@ -1021,6 +1021,14 @@ static int32_t doLoadFileDataBlock(STsdbQueryHandle* pQueryHandle, SBlock* pBloc
|
||||||
|
|
||||||
pBlock->numOfRows = pCols->numOfRows;
|
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);
|
int64_t elapsedTime = (taosGetTimestampUs() - st);
|
||||||
pQueryHandle->cost.blockLoadTime += elapsedTime;
|
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.colId == src->colId) {
|
||||||
|
if (pColInfo->info.type != TSDB_DATA_TYPE_BINARY && pColInfo->info.type != TSDB_DATA_TYPE_NCHAR) {
|
||||||
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) {
|
|
||||||
memmove(pData, (char*)src->pData + bytes * start, bytes * num);
|
memmove(pData, (char*)src->pData + bytes * start, bytes * num);
|
||||||
} else { // handle the var-string
|
} else { // handle the var-string
|
||||||
char* dst = pData;
|
char* dst = pData;
|
||||||
|
|
Loading…
Reference in New Issue