Repository navigation
Conversation
Exercise the tree-view query path for series expressions, AND/OR combinations, empty results and multi-block scans, which previously had no test coverage. Fixes surfaced by the new tests: - init() dereferenced an uninitialized value_col_iter_ to build result-set metadata, crashing every expression query - optimize() allocated a second AND/OR node wrapping the same children and returned it, double-freeing on close - SeriesScanStream and ValueAt reused a TsBlock without resetting it, looping forever once the block filled up
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Copilot review overview
3 open issues
What changed in this PR
Adds comprehensive C++ test coverage for the QDSWithTimeGenerator non-global-time expression query execution path, and fixes multiple defects uncovered by the new tests.
Changes:
- Added
qds_with_timegenerator_test.ccwith 13 cases covering AND/OR cursor behavior, NULL padding, multi-block scanning, pruning, and missing series failures. - Fixed
SeriesScanStream/ValueAtiteration to avoid infinite loops by resettingTsBlockstate betweenget_next()calls. - Fixed expression-query metadata/type handling and
QueryExpression::optimize()ownership to prevent crashes and double-free.
| File | Description |
|---|---|
| cpp/test/reader/qds_with_timegenerator_test.cc | Adds targeted tests to cover previously untested expression-query paths (including multi-block and edge cases). |
| cpp/src/reader/qds_with_timegenerator.cc | Fixes iterator/TsBlock lifecycle and metadata type derivation used by expression queries. |
| cpp/src/reader/expression.cc | Reworks optimization to reuse nodes and avoid double-ownership/double-free. |
Review effort: Lite
Copilot stopped reviewing on behalf of
ColinLeeo due to an error
November 16, 2026 06:44
RowSnapshot has default member initializers, so GCC and MSVC in C++11 mode reject the brace-enclosed aggregate initialization used when appending a row; every non-clang CI job failed to compile the new test. Construct the snapshot explicitly instead. Also address review feedback: - keep ValueAt::at()'s allocate-when-null contract and only reset an already materialized TsBlock - drop the is_null() assertions made after the result set was exhausted - restore tsblock_max_memory_ only when the test actually changed it
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
Add coverage for the tree-view expression query path (
QDSWithTimeGenerator), which previously had 0% line coverage because no test built a non-global-timeQueryExpression.New tests (
cpp/test/reader/qds_with_timegenerator_test.cc, 13 cases):is_nullby name/indexTsBlockboundariesValueAtexhaustion (INT64_MAXshort-circuit) and first-lookup-past-rangeThe new tests exposed three defects in the untested path, fixed here:
QDSWithTimeGenerator::init()dereferenced an uninitializedvalue_col_iter_to build the result-set metadata, crashing every expression query; usessi_->get_data_type()instead.QueryExpression::optimize()allocated a second AND/OR node wrapping the same children and returned it, so it was owned by bothexpression_andmy_exprs_and freed twice on close; reuse the node being optimized.SeriesScanStream/ValueAtreused aTsBlockwithout resetting it, so once the block filled the scan made no progress and looped forever; delete the iterators andreset()the block before the nextget_next().Coverage of
qds_with_timegenerator.cc: 0% -> 98.6% lines, 100% functions.Test plan
./mvnw -B clean verify -P with-java,with-python -Denable.lzma2=ON(Java, C++, Python; 1550 C++ tests passed)./mvnw -B clean verify -P with-cpp -Denable.asan=ON -Dbuild.type=RelWithDebInfo -Denable.lzma2=ON(1638 tests, 0 failed; macOS run used Xcode 26.6 clang andASAN_OPTIONS=detect_container_overflow=0for the uninstrumented ANTLR runtime)./mvnw spotless:check -P with-java,with-python