Skip to content

Add row-range query (queryByRow) across C/C++, Python and Java#740

Closed
hongzhi-gao wants to merge 16 commits intoapache:developfrom
hongzhi-gao:feature/query-by-row
Closed

Add row-range query (queryByRow) across C/C++, Python and Java#740
hongzhi-gao wants to merge 16 commits intoapache:developfrom
hongzhi-gao:feature/query-by-row

Conversation

@hongzhi-gao
Copy link
Contributor

Background

TsFile previously only supported time-range queries. Users who want pagination or bulk-read of the first/last N rows had no efficient way to do it without reading the entire dataset first.

What this PR does

Introduces a queryByRow(offset, limit) API across all three language bindings:

C/C++: RowRangeResultSet wrapper that skips the first offset rows then returns at most limit rows. Exposed via TsFileTreeReader::queryByRow and TsFileReader::queryByRow, plus C-wrapper functions tsfile_reader_query_tree_by_row / tsfile_reader_query_table_by_row. limit < 0 means unlimited.
Python: TsFileReaderPy.query_tree_by_row and query_table_by_row Cython bindings that delegate to the C++ layer.
Java: RowRangeResultSet wrapper with the same semantics added to ITsFileTreeReader / ITsFileReader; implemented in TsFileTreeReader and DeviceTableModelReader.
Key design: once limit rows have been returned, next() returns false immediately without loading further chunks/pages, making the stop early efficient.

Tests added

Each binding has dedicated tests covering: limit=0, limit < total, limit > total, limit=-1 (unlimited), offset-only, offset+limit, offset beyond end, data-value correctness, metadata accessibility, and pagination consistency. C also adds C-wrapper smoke tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant