Fix TRTREE index crash on temporal and span columns#139
Open
estebanzimanyi wants to merge 3 commits into
Open
Conversation
CREATE INDEX USING TRTREE on a tgeompoint or any non-stbox column crashed with DuckDB's generic "assertion failure within DuckDB" message. Bind rejected anything but STBOX/TSTZSPAN through an InternalException (rendered as the fake assertion crash) and the create-physical Finalize path memcpy-reinterpreted the temporal's MEOS-WKB blob as an STBox. Bind now accepts stbox, tbox, the five span types and the eight temporal types, selecting the matching MEOS R-tree flavour. Construct dispatches per column type: span/box blobs are inserted as-is, temporal spatial values derive an SRID-stripped STBox via tspatial_to_stbox, and other temporals go through rtree_insert_temporal. The create-physical parallel path delegates to the same Construct so index keys and the scan-time query box are derived identically. Unsupported column types raise a clean BinderException instead of a fake internal crash. Adds test/sql/parity/050_index_types.test covering every supported column type end-to-end plus the unsupported-type regression. Stacked on the MEOS pin bump (fix/bump-meos-pin) whose post-bump rtree_search and MeosType API this builds against. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
df817c3 to
93acfbb
Compare
Member
Author
Reviewer's quickstart — ~2 minutesWhat this PR does: Fix TRTREE index crash on temporal and span columns. Files to read: Risk: narrow scope; the diff is small and self-contained. Stacked on its base PR — once the stack ahead of it lands, this rebases trivially. Cross-link: Linux arm64 CI needs #161 for the |
`meosType` (lower-case) is the **pre-consolidation** MEOS type name; `MeosType` (upper-case) is the **post-consolidation** target that the upstream rename sweep has not yet reached. The current vcpkg pin (`vcpkg_ports/meos/portfile.cmake` REF f11b7443ee98…) is still pre-consolidation: `meos/include/temporal/meos_catalog.h` line 121 declares the typedef as `} meosType;` and every MEOS API uses the lower-case spelling. MobilityDuck's source code consistently uses `meosType` to match — `grep -rn '\bMeosType\b' src/` finds the name only on the alias line and its comment, nowhere else. c8cad6d added `using meosType = MeosType;` as a forward-looking bridge for the eventual consolidation bump. That bridge points at `MeosType`, which the current pin does NOT yet expose, so it breaks every PR's Linux arm64 build with: /duckdb_build_dir/src/include/tydef.hpp:18:18: error: ‘MeosType’ does not name a type; did you mean ‘meosType’? The fix is to drop the premature alias and replace the misleading comment with one that documents the pre/post-consolidation distinction and the resume path for the next pin bump — at that point a reviewer can either restore the bridge (this time it'll be valid because `MeosType` will exist) or sweep the MobilityDuck source from `meosType` to `MeosType` in a single PR. Unblocks every in-flight PR's Linux arm64 build: #126, #130, #149, #158, #159, #160, plus the entire `feat/*_port_core` extended-type stack (#148/#150/#151/#153/#155/#156).
The stage_icu helper mapped only the Linux uname values, so on the macOS arm64 test runner uname -m returned "arm64" and the icu extension was copied to .duckdb/extensions/v1.4.4/arm64 instead of .../osx_arm64, where DuckDB's autoload looks. The hub fallback is not reliably resolvable on that runner, so the osx_arm64 Test step failed to load the extension. Map the OS and architecture to the DuckDB platform string (linux_amd64, linux_arm64, osx_amd64, osx_arm64) so the locally built icu is staged at the path autoload expects on every tested platform; the Linux mapping is unchanged. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
estebanzimanyi
added a commit
to estebanzimanyi/MobilityDuck
that referenced
this pull request
May 22, 2026
Re-applies the binding content from PRs MobilityDB#130 (parity-final-batch) and MobilityDB#139 (trtree-index-assertion) that the MEOS-pin/symbol-rename refactor silently dropped (the later 3-way merges were no-ops because the content sat in a common ancestor): - temporal_hash(tgeompoint/tgeometry), geometry/geography(tgeompoint) with the TgeoToGeomExec measure-geometry executor, atElevation/minusElevation, transformPipeline(tgeompoint), tgeompointSeqSetGaps, bearing/eCovers surface - TRTREE index support for STBOX/TBOX/span/temporal columns + the mandatory rowid projection (fixes the CREATE INDEX internal crash) - wire TemporalParquetFunctions::Register so temporalFooter is exposed
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.
CREATE INDEX USING TRTREE on a tgeompoint or any non-stbox column crashed with DuckDB's generic "assertion failure within DuckDB" message because bind rejected anything but STBOX/TSTZSPAN through an InternalException and the create-physical Finalize path memcpy-reinterpreted the temporal's MEOS-WKB blob as an STBox struct. Bind now accepts stbox, tbox, the five span types and the eight temporal types and selects the matching MEOS R-tree flavour; Construct dispatches per column type, deriving an SRID-stripped STBox via tspatial_to_stbox for spatial temporals and using rtree_insert_temporal otherwise, while span and box blobs are inserted as-is. The create-physical parallel path delegates to the same Construct so index keys and the scan-time query box are derived identically, and an unsupported column type raises a clean BinderException instead of a fake internal crash. Adds test/sql/parity/050_index_types.test covering every supported column type end-to-end plus the unsupported-type regression. Stacked on #134 (fix/bump-meos-pin) whose post-bump MeosType and MeosArray-based rtree_search API this builds against; rebase onto main once #134 merges.