Skip to content

[C++] Bind table filter expressions to device IDs and field statistics - #1185

Open
ColinLeeo wants to merge 12 commits into
developfrom
refactor/cpp-bind-table-filter-expressions
Open

ColinLeeo wants to merge 12 commits into
developfrom
refactor/cpp-bind-table-filter-expressions

Conversation

@ColinLeeo

Copy link
Copy Markdown
Contributor

Changes

This PR carries forward the shared expression implementation from #1178 and #1184. It targets develop to run the native and MSVC workflows. Incremental diff from #1184.

C++ table queries accept two optional named expressions, tag_filter and field_filter. The reader binds both against the table schema at query preparation and owns the resulting filters. The C wrapper uses the same binding path for prepared table series.

  • TAG operands resolve to STRING TAG columns and match device-ID segments during device enumeration. FIELD operands resolve to typed values and support predicate-only columns.
  • Aligned chunk and page pruning share a three-way statistics test. A disjoint chunk can be skipped before reading its headers. A single-chunk series can use its series statistics. Inconclusive bounds fall back to page or row evaluation.
  • The public C++ table-query overloads that took a raw Filter* and the legacy FIELD row callback have been removed. Callers can pass nullptr for either expression and can release their expressions after query preparation.

Verification

  • C++ with LZMA2 on macOS arm64. All 1,934 enabled Release tests and all 1,935 enabled ASan/UBSan tests passed.
  • Python on macOS arm64. 706 passed and 16 skipped. On Linux arm64, all 15 ownership tests passed with the native library and five Cython extensions instrumented.
  • Go tests, vet and race tests against the matching C++ library
  • C++ Spotless, git diff --check, and a C++11 compile check for the table query and prepared-series signatures

The new chunk-pruning regression injects a read error at the time chunk header. A predicate outside the chunk range completes with zero rows. A predicate inside the range reaches the same header and reports the read error.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.03756% with 102 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.49%. Comparing base (f7a60f1) to head (e5aedf8).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
cpp/src/reader/filter/aligned_field_filter.cc 82.80% 14 Missing and 13 partials ⚠️
cpp/src/reader/filter/tag_filter.cc 75.25% 20 Missing and 4 partials ⚠️
cpp/src/reader/qds_without_timegenerator.cc 78.26% 5 Missing and 10 partials ⚠️
cpp/src/reader/filter/bind_expression.cc 90.80% 2 Missing and 6 partials ⚠️
cpp/src/reader/tsfile_reader.cc 65.21% 5 Missing and 3 partials ⚠️
cpp/src/cwrapper/tsfile_cwrapper.cc 81.81% 3 Missing and 3 partials ⚠️
...p/src/reader/block/single_device_tsblock_reader.cc 88.88% 0 Missing and 3 partials ⚠️
cpp/src/reader/expression.cc 94.91% 0 Missing and 3 partials ⚠️
cpp/src/reader/tsfile_executor.cc 86.36% 2 Missing and 1 partial ⚠️
cpp/src/reader/table_query_executor.cc 80.00% 0 Missing and 2 partials ⚠️
... and 3 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1185      +/-   ##
===========================================
+ Coverage    69.45%   69.49%   +0.03%     
===========================================
  Files          798      796       -2     
  Lines        59106    58940     -166     
  Branches      9630     9609      -21     
===========================================
- Hits         41055    40963      -92     
+ Misses       16266    16190      -76     
- Partials      1785     1787       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants