提交 3adfa055 编写于 作者: C Cary Xu

[TS-995]<fix>(query): validate pTableCheckInfo when querying last/last_row

上级 4801f785
...@@ -593,6 +593,11 @@ void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCon ...@@ -593,6 +593,11 @@ void tsdbResetQueryHandleForNewTable(TsdbQueryHandleT queryHandle, STsdbQueryCon
static int32_t lazyLoadCacheLast(STsdbQueryHandle* pQueryHandle) { static int32_t lazyLoadCacheLast(STsdbQueryHandle* pQueryHandle) {
STsdbRepo* pRepo = pQueryHandle->pTsdb; STsdbRepo* pRepo = pQueryHandle->pTsdb;
if (!pQueryHandle->pTableCheckInfo) {
tsdbError("%p table check info is NULL", pQueryHandle);
return -1;
}
size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo);
int32_t code = 0; int32_t code = 0;
for (size_t i = 0; i < numOfTables; ++i) { for (size_t i = 0; i < numOfTables; ++i) {
...@@ -2762,6 +2767,10 @@ static bool loadBlockOfActiveTable(STsdbQueryHandle* pQueryHandle) { ...@@ -2762,6 +2767,10 @@ static bool loadBlockOfActiveTable(STsdbQueryHandle* pQueryHandle) {
static bool loadCachedLastRow(STsdbQueryHandle* pQueryHandle) { static bool loadCachedLastRow(STsdbQueryHandle* pQueryHandle) {
// the last row is cached in buffer, return it directly. // the last row is cached in buffer, return it directly.
// here note that the pQueryHandle->window must be the TS_INITIALIZER // here note that the pQueryHandle->window must be the TS_INITIALIZER
if (!pQueryHandle || !pQueryHandle->pTableCheckInfo) {
return false;
}
int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle)); int32_t numOfCols = (int32_t)(QH_GET_NUM_OF_COLS(pQueryHandle));
size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo);
assert(numOfTables > 0 && numOfCols > 0); assert(numOfTables > 0 && numOfCols > 0);
...@@ -2801,6 +2810,10 @@ static bool loadCachedLastRow(STsdbQueryHandle* pQueryHandle) { ...@@ -2801,6 +2810,10 @@ static bool loadCachedLastRow(STsdbQueryHandle* pQueryHandle) {
static bool loadCachedLast(STsdbQueryHandle* pQueryHandle) { static bool loadCachedLast(STsdbQueryHandle* pQueryHandle) {
// the last row is cached in buffer, return it directly. // the last row is cached in buffer, return it directly.
// here note that the pQueryHandle->window must be the TS_INITIALIZER // here note that the pQueryHandle->window must be the TS_INITIALIZER
if (!pQueryHandle || !pQueryHandle->pTableCheckInfo) {
return false;
}
int32_t tgNumOfCols = (int32_t)QH_GET_NUM_OF_COLS(pQueryHandle); int32_t tgNumOfCols = (int32_t)QH_GET_NUM_OF_COLS(pQueryHandle);
size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo); size_t numOfTables = taosArrayGetSize(pQueryHandle->pTableCheckInfo);
int32_t numOfRows = 0; int32_t numOfRows = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册