Apply Spice patches to DuckDB 1.5.3#15
Merged
Merged
Conversation
ART Index: Support compound key scans Squashed commit of the following: commit fec3602 Author: David Stancu <david@spice.ai> Date: Mon Nov 3 14:26:06 2025 -0500 tryscanindex: fix direct match lookup, range check vec access commit 2714c3d Author: David Stancu <david@spice.ai> Date: Mon Nov 3 13:55:13 2025 -0500 tryscanindex: do column matching first, to use possibly rebound matches in both sanity check and index expr rebinding add test for this scenario commit 36ffa5b Author: David Stancu <david@spice.ai> Date: Mon Nov 3 12:30:28 2025 -0500 tryscanindex sanity check: indexed_columns / art column ids may not need remapping if the scan is not a view scan commit 525f9c7 Author: David Stancu <david@spice.ai> Date: Thu Oct 30 10:42:17 2025 -0400 do not do index scan if there are other non index filters in the predicate (fix shutdown_create_index.test) commit b0a6e2d Author: David Stancu <david@spice.ai> Date: Thu Oct 30 10:04:54 2025 -0400 add test, bail out for eg composite query with IN () list commit a22a430 Author: David Stancu <david@spice.ai> Date: Wed Oct 29 16:37:30 2025 -0400 simplify filter expression storage index bindings (just reuse the ones we made earlier), fix single-ref-per-expr predicate to correctly walk expr tree and yank refs (allowing nesting in fns, etc) commit 9c8c1ed Author: David Stancu <david@spice.ai> Date: Wed Oct 29 15:11:23 2025 -0400 copy index expressions before rewriting column refs commit aff2c98 Author: David Stancu <david@spice.ai> Date: Wed Oct 29 14:36:33 2025 -0400 table scan: rebind projected columns in ALL index exprs do not bail out early if more than one index expr hook up composite key scan commit bfc6f02 Author: David Stancu <david@spice.ai> Date: Wed Oct 29 14:35:09 2025 -0400 make specialized compound key scan state for eq compares, specialized scan using ARTKey::Concat
* make specialized compound key scan state for eq compares, specialized scan using ARTKey::Concat * table scan: rebind projected columns in ALL index exprs do not bail out early if more than one index expr hook up composite key scan * copy index expressions before rewriting column refs * simplify filter expression storage index bindings (just reuse the ones we made earlier), fix single-ref-per-expr predicate to correctly walk expr tree and yank refs (allowing nesting in fns, etc) * add test, bail out for eg composite query with IN () list * do not do index scan if there are other non index filters in the predicate (fix shutdown_create_index.test) * tryscanindex sanity check: indexed_columns / art column ids may not need remapping if the scan is not a view scan * tryscanindex: do column matching first, to use possibly rebound matches in both sanity check and index expr rebinding add test for this scenario * tryscanindex: fix direct match lookup, range check vec access * compile on gcc
* via spec: get_schema has a lifetime that is owned by the caller, ergo if the caller wants to drop it, we should let them do that * oops, still need to check for valid schema!
rewrite_index_exprs was overwritten (not OR'd) per column match, so if the last index column sat at position i==j the flag reset to false, silently falling back to a sequential scan. Accumulate the flag instead. Add regression test for partially reordered view projections.
There was a problem hiding this comment.
Pull request overview
This PR backports a set of “Spice” patches onto DuckDB 1.5.3, primarily extending ART index scan pushdown capabilities (including compound/composite key equality scans) and adjusting Arrow C API schema handling, along with new regression tests to validate the behavior.
Changes:
- Add ART compound-key (composite index) equality scan initialization and execution paths.
- Update table scan index-pushdown logic to support reordered projections/views and composite ART indexes.
- Add new SQL regression tests covering view/projection binding issues and composite-key index scan usage.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/sql/index/art/scan/test_art_composite_key_scan.test | New regression test asserting composite-key ART index scans are used for multi-column equality predicates. |
| test/sql/index/art/issues/test_art_view_col_binding.test | Extends regression coverage for index scan pushdown through views / projection binding scenarios. |
| test/sql/index/art/issues/test_art_rewrite_index_exprs.test | New regression test for index expression rebinding edge case (i==j on last key column). |
| src/main/capi/arrow-c.cpp | Adjusts Arrow stream schema handling in the C API wrapper used by duckdb_arrow_scan. |
| src/include/duckdb/execution/index/art/art.hpp | Exposes new ART compound-key scan initialization/scan APIs. |
| src/execution/index/art/art.cpp | Implements compound-key scan state creation and point lookup via concatenated ART keys. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ewgenius
approved these changes
Jun 1, 2026
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.
🗣 Description
Tested build + tests
Note, multiple tests are failing due to CI / unrelated to patch:
🔨 Related Issues
🤔 Concerns