Skip to content

enh: query data from text support#35151

Open
facetosea wants to merge 3 commits into3.0from
enh/query/dataFromText
Open

enh: query data from text support#35151
facetosea wants to merge 3 commits into3.0from
enh/query/dataFromText

Conversation

@facetosea
Copy link
Copy Markdown
Contributor

Description

Issue(s)

  • Close/close/Fix/fix/Resolve/resolve: Issue Link

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings April 15, 2026 11:38
@facetosea facetosea requested review from a team, dapan1121 and guanshengliang as code owners April 15, 2026 11:38
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements the TEXT table source feature, enabling the creation of inline data tables within SQL queries. The changes span the parser, planner, and executor, introducing a new RowsetSource operator and associated node types. Technical feedback identifies several high-severity issues, including potential unaligned memory access in the executor, a missing clone implementation for the physical plan node, and security vulnerabilities related to buffer overflows during JSON serialization. Additionally, the reviewer noted architectural inconsistencies regarding redundant fields in the physical plan node that should be addressed for better maintainability.

Comment thread source/libs/executor/src/rowsetscanoperator.c Outdated
Comment thread source/libs/nodes/src/nodesCloneFuncs.c
Comment thread source/libs/nodes/src/nodesCodeFuncs.c Outdated
Comment thread include/libs/nodes/plannodes.h Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new TEXT(...) VALUES (...) table source to allow querying inline rowset data, wiring it through the parser → translator → planner → executor pipeline, and adds CI coverage for the feature.

Changes:

  • Add SQL grammar + AST + translation to build an in-memory SSDataBlock buffer for TEXT table sources.
  • Introduce a new logical/physical plan node (ROWSET_SOURCE) and an executor operator to scan/deserialise the rowset.
  • Add file-based CI tests for TEXT table queries and negative validation cases.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
test/ci/cases.task Adds the new TEXT-source pytest case to CI task list.
test/cases/09-DataQuerying/08-SubQuery/test_text_source.py New pytest covering positive/negative TEXT-source scenarios.
test/cases/09-DataQuerying/08-SubQuery/in/text_source.in Input SQL file for golden-result comparison.
test/cases/09-DataQuerying/08-SubQuery/ans/text_source.ans Expected output for golden-result comparison.
source/libs/parser/src/parTokenizer.c Adds TEXT keyword tokenization.
source/libs/parser/inc/sql.y Adds TEXT (...) VALUES ... as a table_primary.
source/libs/parser/src/parAstCreater.c Creates STextTableNode AST node.
source/libs/parser/inc/parAst.h Declares createTextTableNode.
source/libs/parser/src/parTranslater.c Validates/normalizes TEXT table and builds serialized SSDataBlock buffer; resolves TEXT columns.
include/libs/nodes/querynodes.h Adds STextTableNode definition.
source/libs/planner/src/planLogicCreater.c Builds SRowsetSourceLogicNode for TEXT table.
include/libs/nodes/plannodes.h Adds SRowsetSourceLogicNode / SRowsetSourcePhysiNode.
source/libs/planner/src/planPhysiCreater.c Builds physical ROWSET_SOURCE node from logic node.
source/libs/executor/src/rowsetscanoperator.c New operator to deserialize and scan rowset blocks + apply filters.
source/libs/executor/src/operator.c Wires new physical node type to operator creation.
source/libs/executor/inc/operator.h Declares createRowsetSourceOperatorInfo.
source/libs/nodes/src/nodesUtilFuncs.c Adds make/destroy handling for new node types.
source/libs/nodes/src/nodesTraverseFuncs.c Updates traversal dispatch to recognize TEXT table node type.
source/libs/nodes/src/nodesMsgFuncs.c Adds TLV msg encode/decode for physical rowset source node.
source/libs/nodes/src/nodesCodeFuncs.c Adds JSON encode/decode for rowset source nodes + node names.
source/libs/nodes/src/nodesCloneFuncs.c Adds cloning for TEXT table node + rowset source logic node.
include/common/tmsg.h Adds enum entries for new syntax/plan node types (and reuses an UNUSED physical slot).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread include/common/tmsg.h
Comment thread source/libs/nodes/src/nodesCloneFuncs.c
Comment thread source/libs/planner/src/planLogicCreater.c
Comment thread source/libs/parser/src/parTranslater.c Outdated
Comment thread source/libs/parser/src/parTranslater.c Outdated
Comment thread source/libs/executor/src/rowsetscanoperator.c
Comment on lines +1459 to +1461
case QUERY_NODE_LOGIC_PLAN_ROWSET_SOURCE:
code = logicRowsetSourceCopy((const SRowsetSourceLogicNode*)pNode, (SRowsetSourceLogicNode*)pDst);
break;
Copilot AI review requested due to automatic review settings April 17, 2026 03:41
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces two new query-time data sources—TEXT(...) VALUES (...) (inline rows) and FILE(path, schema_decl [, options]) (CSV-backed)—by translating both into a shared rowset-backed plan/operator, and adds system tests to validate querying, joins, windows, group-by, and external-window integration.

Changes:

  • Added parser/AST support for TEXT and FILE table_primary forms, including FILE options (header, delimiter) and translation into serialized SSDataBlock buffers.
  • Added a new ROWSET_SOURCE logic/physical plan node and executor operator to scan serialized rowset blocks with filter pushdown.
  • Added CI + regression test coverage for TEXT/FILE sources and TEXT as an EXTERNAL_WINDOW source.

Reviewed changes

Copilot reviewed 41 out of 41 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/ci/cases.task Adds CI execution entries for new TEXT/FILE subquery tests
test/cases/13-TimeSeriesExt/08-ExternalWindow/test_external.py Runs new regression covering TEXT as external_window subquery source
test/cases/13-TimeSeriesExt/08-ExternalWindow/in/text_as_window.in SQL inputs for TEXT-driven external_window regression
test/cases/13-TimeSeriesExt/08-ExternalWindow/ans/text_as_window.ans Expected output for TEXT-driven external_window regression
test/cases/09-DataQuerying/08-SubQuery/test_text_source.py New pytest suite for TEXT source (positive + negative + windows + group-by)
test/cases/09-DataQuerying/08-SubQuery/test_file_source.py New pytest suite for FILE source (positive + negative + group-by)
test/cases/09-DataQuerying/08-SubQuery/in/text_source.in TEXT source SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/text_source.ans TEXT source expected results
test/cases/09-DataQuerying/08-SubQuery/in/text_window.in TEXT window SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/text_window.ans TEXT window expected results
test/cases/09-DataQuerying/08-SubQuery/in/text_groupby.in TEXT group-by / partition-by SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/text_groupby.ans TEXT group-by / partition-by expected results
test/cases/09-DataQuerying/08-SubQuery/in/text_type_special.in TEXT DECIMAL/GEOMETRY SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/text_type_special.ans TEXT DECIMAL/GEOMETRY expected results
test/cases/09-DataQuerying/08-SubQuery/in/file_source.in FILE source SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/file_source.ans FILE source expected results
test/cases/09-DataQuerying/08-SubQuery/in/file_source_groupby.in FILE group-by SQL test inputs
test/cases/09-DataQuerying/08-SubQuery/ans/file_source_groupby.ans FILE group-by expected results
test/cases/09-DataQuerying/08-SubQuery/in/file_source_basic.csv FILE test CSV data (basic)
test/cases/09-DataQuerying/08-SubQuery/in/file_source_header.csv FILE test CSV data (header=true)
test/cases/09-DataQuerying/08-SubQuery/in/file_source_nulls.csv FILE test CSV data (NULL/empty fields)
test/cases/09-DataQuerying/08-SubQuery/in/file_source_unsorted.csv FILE test CSV data (unsorted rows)
test/cases/09-DataQuerying/08-SubQuery/in/file_source_groups.csv FILE test CSV data (group-by)
source/libs/parser/src/parTokenizer.c Adds TEXT keyword tokenization (and relies on existing FILE keyword)
source/libs/parser/inc/sql.y Adds grammar for TEXT/FILE table_primary + FILE options + TEXT row list
source/libs/parser/src/parAstCreater.c Creates AST nodes for TEXT and FILE table sources
source/libs/parser/inc/parAst.h Declares AST helpers and FILE option struct
source/libs/parser/src/parTranslater.c Translates TEXT VALUES/FILE CSV into serialized rowset buffers + column binding
include/common/tmsg.h Adds new node types for TEXT/FILE and ROWSET_SOURCE logic/physical nodes
include/libs/nodes/querynodes.h Defines STextTableNode and SFileTableNode
include/libs/nodes/plannodes.h Defines SRowsetSourceLogicNode and SRowsetSourcePhysiNode
source/libs/nodes/src/nodesUtilFuncs.c Alloc/free support for new node types (TEXT/FILE/ROWSET_SOURCE)
source/libs/nodes/src/nodesCloneFuncs.c Clone support for TEXT/FILE/ROWSET_SOURCE nodes
source/libs/nodes/src/nodesTraverseFuncs.c Marks TEXT table node as traversable “leaf” in walkers/rewriters
source/libs/nodes/src/nodesMsgFuncs.c TLV encode/decode for PhysiRowsetSource node
source/libs/nodes/src/nodesCodeFuncs.c JSON encode/decode + node name mapping for ROWSET_SOURCE nodes
source/libs/planner/src/planLogicCreater.c Converts TEXT/FILE table nodes into a common RowsetSource logic node
source/libs/planner/src/planPhysiCreater.c Converts RowsetSource logic node into RowsetSource physical node (moves pBlockBuf)
source/libs/executor/src/rowsetscanoperator.c New executor operator to deserialize rowset blocks and scan/filter them
source/libs/executor/src/operator.c Wires ROWSET_SOURCE into operator factory
source/libs/executor/inc/operator.h Declares createRowsetSourceOperatorInfo

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/libs/parser/src/parTranslater.c Outdated
Comment thread source/libs/parser/src/parTranslater.c
Comment on lines +7397 to +7402
pCol->node.resType = pDef->dataType;
pCol->colId = slot;
pCol->colType = COLUMN_TYPE_COLUMN;
if (slot == pFileTable->primaryTsSlot && pFileTable->hasPrimaryTs) {
pCol->isPrimTs = true;
}
Copilot AI review requested due to automatic review settings April 20, 2026 06:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for querying inline rowset data from TEXT(...) VALUES ... and CSV-backed FILE(path, schema_decl [, options]) table sources by translating them into a serialized SSDataBlock rowset and executing via a new RowsetSource operator.

Changes:

  • Add parser/AST + translator support for TEXT and FILE table sources, including row-materialization and optional auto-sort by primary timestamp.
  • Introduce RowsetSource logic/physical plan nodes + executor operator to scan the serialized rowset safely, and prevent projection-pruning from corrupting rowset decoding.
  • Add CI-wired regression tests for TEXT/FILE sources, plus an EXTERNAL_WINDOW regression using TEXT as the window-definition source.

Reviewed changes

Copilot reviewed 44 out of 45 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/ci/cases.task Adds new pytest cases for TEXT/FILE sources into CI task list.
test/cases/13-TimeSeriesExt/08-ExternalWindow/test_external.py Runs new TEXT-as-window regression in the external window suite.
test/cases/13-TimeSeriesExt/08-ExternalWindow/in/text_as_window.in SQL input for TEXT-driven EXTERNAL_WINDOW regression scenarios.
test/cases/13-TimeSeriesExt/08-ExternalWindow/ans/text_as_window.ans Expected output for TEXT-driven EXTERNAL_WINDOW regression.
test/cases/09-DataQuerying/08-SubQuery/test_text_source.py Adds comprehensive TEXT source tests (positive/negative/window/groupby/large).
test/cases/09-DataQuerying/08-SubQuery/test_file_source.py Adds comprehensive FILE source tests (positive/negative/large/coverage/groupby).
test/cases/09-DataQuerying/08-SubQuery/in/text_window.in Window-query SQL coverage for TEXT sources.
test/cases/09-DataQuerying/08-SubQuery/in/text_type_special.in TEXT coverage for DECIMAL/GEOMETRY edge behaviors.
test/cases/09-DataQuerying/08-SubQuery/in/text_source.in Main TEXT source SQL coverage (types, predicates, joins, subqueries).
test/cases/09-DataQuerying/08-SubQuery/in/text_groupby.in TEXT GROUP BY / PARTITION BY SQL coverage.
test/cases/09-DataQuerying/08-SubQuery/in/file_source_basic.csv FILE source CSV fixture (basic).
test/cases/09-DataQuerying/08-SubQuery/in/file_source_header.csv FILE source CSV fixture (header=true).
test/cases/09-DataQuerying/08-SubQuery/in/file_source_nulls.csv FILE source CSV fixture (NULL/empty fields).
test/cases/09-DataQuerying/08-SubQuery/in/file_source_unsorted.csv FILE source CSV fixture (unsorted timestamps).
test/cases/09-DataQuerying/08-SubQuery/in/file_source_groups.csv FILE source CSV fixture for GROUP BY.
test/cases/09-DataQuerying/08-SubQuery/in/file_source_widecols.csv FILE source CSV fixture for wide-column tests.
test/cases/09-DataQuerying/08-SubQuery/in/file_source_bad_types.csv FILE source CSV fixture for coercion behavior.
test/cases/09-DataQuerying/08-SubQuery/in/file_source.in SQL input for FILE source positive coverage.
test/cases/09-DataQuerying/08-SubQuery/in/file_source_groupby.in SQL input for FILE source GROUP BY coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/text_window.ans Expected output for TEXT window coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/text_type_special.ans Expected output for TEXT DECIMAL/GEOMETRY coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/text_source.ans Expected output for main TEXT coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/text_groupby.ans Expected output for TEXT GROUP BY / PARTITION BY coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/file_source.ans Expected output for FILE source positive coverage.
test/cases/09-DataQuerying/08-SubQuery/ans/file_source_groupby.ans Expected output for FILE GROUP BY coverage.
source/libs/planner/src/planPhysiCreater.c Adds physical-plan creation for RowsetSource nodes and transfers rowset buffer ownership.
source/libs/planner/src/planOptimizer.c Prevents projection elimination from pruning RowsetSource targets (avoids decode overflow).
source/libs/planner/src/planLogicCreater.c Creates a shared RowsetSource logic node for both TEXT and FILE sources.
source/libs/parser/src/parTranslater.c Implements TEXT/FILE translation, rowset materialization, CSV parsing, and column resolution.
source/libs/parser/src/parTokenizer.c Adds TEXT keyword token.
source/libs/parser/src/parAstCreater.c Adds AST constructors for TEXT table node and FILE table node (+ options parsing).
source/libs/parser/inc/sql.y Adds grammar for TEXT(...) VALUES ... and FILE('path','schema'[,opts]).
source/libs/parser/inc/parAst.h Declares new AST creation APIs and FILE options struct.
source/libs/nodes/src/nodesUtilFuncs.c Registers node allocation/destruction for TEXT/FILE and RowsetSource logic/physical nodes.
source/libs/nodes/src/nodesTraverseFuncs.c Updates traversal switch to recognize TEXT table nodes.
source/libs/nodes/src/nodesMsgFuncs.c Adds TLV encode/decode for RowsetSource physical node.
source/libs/nodes/src/nodesCodeFuncs.c Adds JSON encode/decode for RowsetSource logic/physical nodes.
source/libs/nodes/src/nodesCloneFuncs.c Adds clone support for TEXT/FILE table nodes and RowsetSource nodes (deep-copy buffers).
source/libs/executor/src/rowsetscanoperator.c New executor operator that deserializes rowset blocks and applies filters.
source/libs/executor/src/operator.c Wires RowsetSource operator creation into operator factory.
source/libs/executor/inc/operator.h Declares RowsetSource operator factory function.
include/libs/nodes/querynodes.h Defines STextTableNode and SFileTableNode.
include/libs/nodes/plannodes.h Defines RowsetSource logic/physical node structs.
include/common/tmsg.h Adds node type enums for TEXT/FILE tables and RowsetSource logic/physical nodes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread source/libs/nodes/src/nodesMsgFuncs.c Outdated
Comment thread source/libs/parser/src/parTranslater.c Outdated
Implement FILE data source that reads CSV files at query time,
parallel to the existing TEXT table source feature.

Core changes:
- include/common/tmsg.h: add QUERY_NODE_FILE_TABLE node type
- include/libs/nodes/querynodes.h: SFileTableNode struct (path, schemaDecl,
  header, delimiter, pColDefs, block buffer, sort metadata)
- nodes/nodesUtilFuncs.c + nodesCloneFuncs.c: makeNode/destroy/copy support
- parser/sql.y: FILE() grammar rules, remove FILE from fallback list,
  add NK_BOOL option rule for header=true syntax
- parser/parAst.h + parAstCreater.c: SFileOptions, parseFileOption
  (handles TK_NK_BOOL), createFileTableNode
- parser/parTranslater.c: translateFileTable with CSV parse helpers
  (parseFileSchemaDecl, splitCsvLine, trimFieldValue, convertAndSetField,
  buildFileTableBlockBuf); findAndSetFileTableColumn; createColumnsByTable
  and findAndSetColumn dispatch for FILE_TABLE
- planner/planLogicCreater.c: SRowsetSourceDesc refactor; FILE_TABLE case
  in doCreateLogicNodeByTable

Test artifacts:
- test/cases/09-DataQuerying/08-SubQuery/test_file_source.py
- in/file_source.in, in/file_source_groupby.in  (SQL query files)
- ans/file_source.ans, ans/file_source_groupby.ans  (expected results)
- in/file_source_basic.csv, file_source_header.csv, file_source_nulls.csv,
  file_source_unsorted.csv, file_source_groups.csv  (CSV test data)
- test/ci/cases.task: register test_file_source.py
@facetosea facetosea force-pushed the enh/query/dataFromText branch from 5d27598 to a4ceb64 Compare April 20, 2026 10:39
- nodesCloneFuncs.c: copy isSortedByTs field in textTableNodeCopy().
  Missing copy caused cloned nodes to lose the sort property,
  leading to wrong planner decisions on sort-aware operations.

- nodesMsgFuncs.c: remove leftover debug nodesError() in nodesNodeToMsg().
  The log was emitted unconditionally on every serialization call,
  spamming the error log in production.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 20, 2026 10:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for querying inline rowsets from TEXT(...) VALUES (...) and CSV-backed FILE(path, schema_decl [, options...]) sources by translating them into a new RowsetSource plan/operator path, plus adds CI regression coverage for the new sources (including use in EXTERNAL_WINDOW).

Changes:

  • Add parser AST + translator support for TEXT and FILE table-primary sources, including row/cell/serialized-size caps and (optional) ts-order normalization.
  • Introduce new logical/physical plan node ROWSET_SOURCE, plus an executor operator to deserialize and scan embedded SSDataBlock buffers.
  • Add extensive pytest + golden-file regression tests and wire them into CI.

Reviewed changes

Copilot reviewed 44 out of 45 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
test/ci/cases.task Runs new TEXT/FILE source test suites in CI.
test/cases/13-TimeSeriesExt/08-ExternalWindow/test_external.py Adds regression using TEXT as EXTERNAL_WINDOW source.
test/cases/13-TimeSeriesExt/08-ExternalWindow/in/text_as_window.in SQL cases for TEXT-as-window-source.
test/cases/13-TimeSeriesExt/08-ExternalWindow/ans/text_as_window.ans Expected outputs for TEXT-as-window-source.
test/cases/09-DataQuerying/08-SubQuery/test_text_source.py TEXT source regression coverage (queries/windows/types/limits/groupby).
test/cases/09-DataQuerying/08-SubQuery/test_file_source.py FILE source regression coverage (queries/limits/groupby/edge cases).
test/cases/09-DataQuerying/08-SubQuery/in/* New SQL + CSV inputs for TEXT/FILE regression.
test/cases/09-DataQuerying/08-SubQuery/ans/* Expected outputs for TEXT/FILE regression.
source/libs/planner/src/planPhysiCreater.c Creates physical ROWSET_SOURCE nodes and transfers buffer ownership.
source/libs/planner/src/planOptimizer.c Prevents unsafe target-pruning for RowsetSource nodes.
source/libs/planner/src/planLogicCreater.c Builds RowsetSource logical nodes for TEXT/FILE tables.
source/libs/parser/src/parTokenizer.c Adds TEXT as a keyword token.
source/libs/parser/src/parAstCreater.c Adds AST construction for TEXT/FILE table nodes and FILE options parsing.
source/libs/parser/inc/sql.y Adds grammar for TEXT(...) VALUES ... and FILE(...) table_primary.
source/libs/parser/inc/parAst.h Declares new AST constructors + FILE options struct.
source/libs/parser/src/parTranslater.c Translates TEXT/FILE into serialized SSDataBlock buffers + namespace binding.
source/libs/nodes/src/nodesUtilFuncs.c Alloc/free/clone support for new AST/plan node types.
source/libs/nodes/src/nodesTraverseFuncs.c Updates traversal to treat TEXT tables as leaf nodes (but FILE missing).
source/libs/nodes/src/nodesMsgFuncs.c TLV encode/decode for physical RowsetSource nodes.
source/libs/nodes/src/nodesCodeFuncs.c JSON encode/decode for logical/physical RowsetSource nodes.
source/libs/nodes/src/nodesCloneFuncs.c Deep-clone support for TEXT/FILE table nodes and RowsetSource plan nodes.
source/libs/executor/src/rowsetscanoperator.c New RowsetSource operator: deserialize block(s), apply filters, stream blocks.
source/libs/executor/src/operator.c Wires RowsetSource operator into operator factory and stabilizes blockId read.
source/libs/executor/inc/operator.h Declares RowsetSource operator constructor.
include/libs/nodes/querynodes.h Adds STextTableNode and SFileTableNode AST structs.
include/libs/nodes/plannodes.h Adds logical/physical SRowsetSource*Node structs.
include/common/tmsg.h Adds enum values for new node types and reuses an UNUSED physical-plan slot.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +7570 to +7578
if (pTextTable->hasPrimaryTs && rowCount >= 2) {
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, 0);
bool sorted = true;
int64_t prevTs = *(int64_t*)colDataGetData(pTsCol, 0);
for (int32_t i = 1; i < rowCount && sorted; ++i) {
int64_t currTs = *(int64_t*)colDataGetData(pTsCol, i);
if (currTs < prevTs) sorted = false;
prevTs = currTs;
}
break;
case QUERY_NODE_REAL_TABLE:
case QUERY_NODE_TEMP_TABLE:
case QUERY_NODE_TEXT_TABLE:
}
case QUERY_NODE_REAL_TABLE:
case QUERY_NODE_TEMP_TABLE:
case QUERY_NODE_TEXT_TABLE:
Comment on lines +8399 to +8405
if (!pPath || pPath->n < 2) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "FILE requires a path string");
return NULL;
}
if (!pSchemaDecl || pSchemaDecl->n < 2) {
pCxt->errCode = generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_SYNTAX_ERROR, "FILE requires a schema_decl string");
return NULL;
Comment on lines +7888 to +7893
/* Open file */
TdFilePtr fp = taosOpenFile(pFile->path, TD_FILE_READ | TD_FILE_STREAM);
if (!fp) {
return generateSyntaxErrMsg(&pCxt->msgBuf, TSDB_CODE_PAR_INTERNAL_ERROR,
"FILE: cannot open '%s'", pFile->path);
}
Comment on lines +8018 to +8027
/* Sort by primary-ts if needed */
if (pFile->hasPrimaryTs && rowCount >= 2) {
SColumnInfoData* pTsCol = taosArrayGet(pBlock->pDataBlock, 0);
bool sorted = true;
int64_t prevTs = *(int64_t*)colDataGetData(pTsCol, 0);
for (int32_t i = 1; i < rowCount && sorted; i++) {
int64_t currTs = *(int64_t*)colDataGetData(pTsCol, i);
if (currTs < prevTs) sorted = false;
prevTs = currTs;
}
Comment on lines +134 to +143
// blockDataFromBuf doesn't restore hasNull flag; do it now
int32_t numCols = (int32_t)taosArrayGetSize(pBlock->pDataBlock);
for (int32_t c = 0; c < numCols; ++c) {
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, c);
if (pCol == NULL || IS_VAR_DATA_TYPE(pCol->info.type) || pCol->nullbitmap == NULL) continue;
for (int32_t r = 0; r < pBlock->info.rows; ++r) {
if (colDataIsNull_f(pCol, r)) { pCol->hasNull = true; break; }
}
}

Comment on lines +303 to +305
self._run_groupby_queries()

tdLog.debug("test_file_source_groupby passed")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants