diff --git a/src/tsdb/src/tsdbRead.c b/src/tsdb/src/tsdbRead.c index cd421032cd963f1738ba7bcc480033ce50a3330c..b16337ed7a6537f341e53b7d47b4867ea0c011cd 100644 --- a/src/tsdb/src/tsdbRead.c +++ b/src/tsdb/src/tsdbRead.c @@ -1180,9 +1180,12 @@ static void copyOneRowFromMem(STsdbQueryHandle* pQueryHandle, int32_t capacity, char* pData = NULL; // the schema version info is embeded in SDataRow - int32_t numOfRowCols = schemaNCols(pSchema); + int32_t numOfRowCols = 0; if (pSchema == NULL) { pSchema = tsdbGetTableSchemaByVersion(pTable, dataRowVersion(row)); + numOfRowCols = schemaNCols(pSchema); + } else { + numOfRowCols = schemaNCols(pSchema); } int32_t i = 0, j = 0;