Add row-range query (queryByRow) across C/C++, Python and Java#741
Open
hongzhi-gao wants to merge 5 commits intoapache:developfrom
Open
Add row-range query (queryByRow) across C/C++, Python and Java#741hongzhi-gao wants to merge 5 commits intoapache:developfrom
hongzhi-gao wants to merge 5 commits intoapache:developfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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