Repository navigation
Conversation
Python table-model queries only accepted TAG predicates; FIELD value filtering existed only inside the C++ table query executor. - cwrapper: add a FieldFilterHandle API over AlignedFieldFilter (create checked/and/or/not/free) plus tsfile_query_table_with_filters and tsfile_reader_query_table_by_row_with_filters. Handles are borrowed and deep-copied per query, so callers keep ownership. - TsFileReader: query/queryByRow overloads taking a FIELD filter; the executor owns it once invoked and the reader deletes it on the validation paths that return earlier. - AlignedFieldFilter: add clone() for the copy-per-query contract. - Python: new field_filter module (field_eq/field_neq/ordered, field_between/field_not_between, field_is_null/field_is_not_null, compose with &, |, ~); query_table and query_table_by_row accept field_filter=. Values normalize as bool/int64/double/string, with TypeMismatchError, ColumnNotExistError and InvalidArgumentError for bad column/type/operator combinations; None is rejected in favour of the IS NULL predicates. - Tests: cwrapper C API coverage (selection, composition, reuse, errors, by-row paging) and Python DSL plus end-to-end query tests (scalar, Arrow batch, by-row, NULL semantics, type errors). - Skills: document FIELD filters for Python, C and C++. The CLI keeps --tag-filter only: this change adds a Python-side query option and does not alter existing CLI-visible behavior, so no CLI command/option synchronization is applicable.
Address the review findings on 4e47594: - Accept batch_size < 0 as row-by-row mode in tsfile_query_table_with_filters and tsfile_reader_query_table_by_row_with_filters. This matches query_table without a FIELD filter and the documented promise that batch_size <= 0 selects row-by-row mode. - Document start_time/end_time/offset/limit/batch_size on the new C query entry points. - Drop the unreachable null check around AlignedFieldFilter::clone(); allocation failure propagates as an exception and maps to E_OOM. - Tests: negative batch_size parity, INT32 and FLOAT column literals, NOT of AND/OR compounds (C++ and Python), FLOAT narrowing in the C API.
Contributor
Author
|
Superseded by #1169 after the branch was renamed. |
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.
Summary
Python table-model queries could only filter TAG columns (
TagFilter); FIELD predicates were not exposed, even though the C++ aligned field filter already existed. This adds a PythonFieldFilterAPI and pushes it down through the C wrapper into the table query executor.API
field_eq/field_neq/field_lt/field_lteq/field_gt/field_gteq/field_between/field_not_between/field_is_null/field_is_not_null, composable with&,|,~, and passed asfield_filter=toTsFileReader.query_table(row and batch modes) andquery_table_by_row. FIELD and TAG filters compose.Changes
python/tsfile/field_filter.pyplus exports inpython/tsfile/__init__.py.tsfile_field_filter_*create/and/or/not/free andtsfile_query_table_with_filters/..._by_row_with_filters; the filter handle is deep-cloned per query and ownership is handed to the executor, which deletes it on every early-return path.tsfile_reader.pyx/tsfile_py_cpp.pyx; result sets keep their handles alive and free them after the native result set.batch_sizenow behaves the same with and without a filter.skills/tsfile/references/properties-filters.mdandpython.md.Verification
test_field_filter.py,test_field_filter_query.py) cover comparisons, BETWEEN / NOT BETWEEN, composite expressions, NULL semantics, type/column errors, and TAG + FIELD composition.batch_sizefix concluded CLOSE.4e47594a,603c8734.