Repository navigation
Generate the index search of every operator from the catalog - #425
Merged
estebanzimanyi merged 1 commit intoOct 2, 2026
Merged
estebanzimanyi merged 1 commit into
estebanzimanyi merged 1 commit into
Conversation
tools/codegen_duck_udfs.py writes src/include/generated/index_search_ops.hpp from the catalog's
per-signature indexSearch {columnLeft, columnRight}: one row per name a signature is reached
under, its SQL name and its operator's symbol, the symbol read from the doc comment of its
columnLeft value in the catalog's IndexSearchOp enum, carrying the search of `column <name> query`
and, when the operator's MobilityDB declaration has a COMMUTATOR, the search of
`query <name> column`. A name routed to two different searches fails generation. The hand-written
index_search_ops.hpp keeps only what the catalog does not state, the axis each search compares
along and the box types carrying it, and reads every name from the generated table. The R-tree and
SP-tree scan optimizers ask that table before taking the index, so a predicate whose operand order
has no search stays a filter answered by a scan.
Why: the hand-written table answered the overlapping orderings with the query on the left by the
opposite ordering, `query &< column` through INDEX_OVERRIGHT, which states a different predicate:
INDEX_OVERRIGHT accepts every stored box whose start is not before the query's start, while
`query &< column` holds of a box whose end is not before the query's end. No search states the
latter, which is why MobilityDB declares `&<` without a COMMUTATOR and its operator classes leave
it to a scan. The catalog states each operator's searches from that declaration, so reading them
from it makes the routing the MobilityDB one.
Witness: over 2999 points (i, i), with the query box X [500, 501], the index answered
`query &< t` with 2500 rows where a scan answers 2499, `query &> t` with 501 for 500 and
stboxOverbefore(query, t) with 2634 for 2633; now the plan of each holds no MOBILITY RTREE INDEX
and the three answer as the scan, while `query << t` still reaches the index through its commuted
INDEX_RIGHT and agrees with the scan.
Measured: the generated table holds 90 names from the catalog of the pinned commit, every
overlapping ordering without a commuted search and every strict one commuting to its opposite;
the generated UDF sources do not change. test/sql/parity/095_index_ordering_query_on_left.test
fails on the hand-written table at its first `&<` plan check and passes its 23 assertions now;
the full suite passes 3089 assertions in 109 test cases, with no compiler warning in the changed
files.
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.
tools/codegen_duck_udfs.py writes src/include/generated/index_search_ops.hpp from the catalog's
per-signature indexSearch {columnLeft, columnRight}: one row per name a signature is reached
under, its SQL name and its operator's symbol, the symbol read from the doc comment of its
columnLeft value in the catalog's IndexSearchOp enum, carrying the search of
column <name> queryand, when the operator's MobilityDB declaration has a COMMUTATOR, the search of
query <name> column. A name routed to two different searches fails generation. The hand-writtenindex_search_ops.hpp keeps only what the catalog does not state, the axis each search compares
along and the box types carrying it, and reads every name from the generated table. The R-tree and
SP-tree scan optimizers ask that table before taking the index, so a predicate whose operand order
has no search stays a filter answered by a scan.
Why: the hand-written table answered the overlapping orderings with the query on the left by the
opposite ordering,
query &< columnthrough INDEX_OVERRIGHT, which states a different predicate:INDEX_OVERRIGHT accepts every stored box whose start is not before the query's start, while
query &< columnholds of a box whose end is not before the query's end. No search states thelatter, which is why MobilityDB declares
&<without a COMMUTATOR and its operator classes leaveit to a scan. The catalog states each operator's searches from that declaration, so reading them
from it makes the routing the MobilityDB one.
Witness: over 2999 points (i, i), with the query box X [500, 501], the index answered
query &< twith 2500 rows where a scan answers 2499,query &> twith 501 for 500 andstboxOverbefore(query, t) with 2634 for 2633; now the plan of each holds no MOBILITY RTREE INDEX
and the three answer as the scan, while
query << tstill reaches the index through its commutedINDEX_RIGHT and agrees with the scan.
Measured: the generated table holds 90 names from the catalog of the pinned commit, every
overlapping ordering without a commuted search and every strict one commuting to its opposite;
the generated UDF sources do not change. test/sql/parity/095_index_ordering_query_on_left.test
fails on the hand-written table at its first
&<plan check and passes its 23 assertions now;the full suite passes 3089 assertions in 109 test cases, with no compiler warning in the changed
files.