Skip to content

feat(bindings): spans(<set_type>) — list of unit spans from a set#9

Merged
nhungoc1508 merged 1 commit into
feat/splitnspans-lowercase-aliasfrom
feat/spans-set-type
Apr 27, 2026
Merged

feat(bindings): spans(<set_type>) — list of unit spans from a set#9
nhungoc1508 merged 1 commit into
feat/splitnspans-lowercase-aliasfrom
feat/spans-set-type

Conversation

@estebanzimanyi

Copy link
Copy Markdown
Member

Summary

Adds the set-level spans scalar for all five set types (intset/bigintset/floatset/dateset/tstzset), mirroring SpansetFunctions::Spanset_spans but reading a Set and calling the MEOS-side set_spans(s) + set_num_values(s) pair.

SpanFunctions::Set_spans already existed as a stub in src/temporal/span_functions.cpp but was never registered and had the wrong semantics — it was a BinaryExecutor calling set_to_span that returned a single Span, not a list. Replaced with a proper list-building implementation and registered spans(<set_type>) as a LIST(<span_type>) returner for each of the five set types.

Parity file

Unwraps the spans(intset ...) skip block — 1 query now active.

Test plan

  • TZ=UTC ./build/release/test/unittest "<proj>/test/*" locally: 747 assertions pass across 13 test cases, no regressions.
  • CI validates on linux_amd64, linux_arm64, macos, wasm.

Dependencies

Stacked on top of the MEOS error handler / lowercase aliases chain. Merge order: #7#8 → this.

🤖 Generated with Claude Code

Adds the set-level spans scalar for all five set types
(intset/bigintset/floatset/dateset/tstzset), reading a Set and
calling MEOS set_spans(s) + set_num_values(s) to build a
LIST(<span_type>) result.

SpanFunctions::Set_spans existed as a stub but was never registered
and had wrong semantics (BinaryExecutor calling set_to_span returning
a single Span, not a list). Replaces the body with a proper
list-building implementation and registers spans(<set_type>) for each
of the five set types.

Activates the spans(intset ...) query in
test/sql/parity/001_set.test.
@estebanzimanyi estebanzimanyi force-pushed the feat/splitnspans-lowercase-alias branch from 52feed7 to cdea92e Compare April 25, 2026 08:43
@nhungoc1508 nhungoc1508 merged commit 9337c20 into feat/splitnspans-lowercase-alias Apr 27, 2026
17 checks passed
@estebanzimanyi

Copy link
Copy Markdown
Member Author

@nhungoc1508 — flagging a merge-target issue. This PR is marked MERGED, but the merge commit went into the stack-base branch, not main:

Net effect: this PR's contents never reached main. Verified by greping src/ on origin/mainsplitnspans (lowercase) and spans(<set_type>) constructor are absent.

Re-landed in #44, which brings both commits forward as a clean linear history on top of main using the existing branch.

For future stacked PRs: when a base PR (e.g. #7) is merged into main, the dependent PRs (#8, #9) should have their base updated to main (gh pr edit <N> --base main) before merging — otherwise the merge target stays the now-deleted/abandoned base branch and the work doesn't propagate.

estebanzimanyi added a commit that referenced this pull request May 10, 2026
Bumps `vcpkg_ports/meos/portfile.cmake` REF from current master to
the `th3index` branch tip (`87a89db2f`).  Adds `-DH3=ON` to the MEOS
CMake configure and `h3` as a vcpkg dependency so libmeos.a exports
the 66-symbol `meos_h3.h` API surface (`h3index_in`, `th3index_*`,
`tgeompoint_to_th3index`, etc.).

Prerequisite for the MobilityDuck H3INDEX / TH3INDEX type
registrations and the cross-platform BerlinMOD benchmark prefilter
(MobilitySpark PR #9 ports the same surface to Spark; this lands
the matching layer on the DuckDB binding so all three platforms
can run the same H3-prefiltered queries).
estebanzimanyi added a commit that referenced this pull request May 10, 2026
Lands the MobilityDuck binding for the temporal H3 index types, in
lock-step with MobilitySpark's th3index port (PR #9 over there) so
all three platforms run the same H3-prefiltered BerlinMOD queries.

Surface:
  H3INDEX           → BIGINT alias (64-bit cell id; signed reinterp
                      is safe — comparison cares only about bit
                      pattern).
  TH3INDEX          → BLOB alias (Temporal* blob).

Functions registered (mapped from `meos_h3.h`):
  I/O
    h3IndexFromText / h3IndexAsText / VARCHAR↔H3INDEX casts
    VARCHAR↔TH3INDEX casts
  Constructor
    th3index(H3INDEX, TIMESTAMPTZ)
  Accessors
    startValue / endValue / valueN / values / valueAtTimestamp
  Type casts
    th3index(tbigint), tbigint(th3index)
    th3index(tgeompoint, INT), th3index(tgeogpoint, INT)
    tgeompoint(th3index), tgeogpoint(th3index)
  Ever/always predicates (12 overloads)
    everEq / everNe / alwaysEq / alwaysNe across H3INDEX×TH3INDEX,
    TH3INDEX×H3INDEX, TH3INDEX×TH3INDEX
  Temporal eq/ne (6 overloads)
    tEq / tNe across the same 3 shapes
  H3 cell properties
    th3indexGetResolution / th3indexGetBaseCellNumber /
    th3indexIsValidCell / th3indexIsResClassIII /
    th3indexIsPentagon
  Hierarchy
    th3indexCellToParent[+Next] / th3indexCellToCenterChild[+Next]
    th3indexCellToChildPos / th3indexChildPosToCell
  Geometry / boundary
    th3indexCellToBoundary
  Directed edges
    th3indexAreNeighborCells / th3indexCellsToDirectedEdge
    th3indexIsValidDirectedEdge /
    th3indexGetDirectedEdge[Origin|Destination]
    th3indexDirectedEdgeToBoundary
  Vertices
    th3indexCellToVertex / th3indexVertexToLatlng /
    th3indexIsValidVertex
  Grid traversal
    th3indexGridDistance / th3indexCellToLocalIj /
    th3indexLocalIjToCell
  Cell area / edge length / great-circle distance
    th3indexCellArea / th3indexEdgeLength /
    tgeogpointGreatCircleDistance

Template-macro `TH3_UNARY_TEMP`, `TH3_TEMP_INT32_TEMP`,
`TH3_TEMP_TEMP_TEMP`, `TH3_TEMP_TEXT_TEMP`, `TH3_EA_H3_T`,
`TH3_EA_T_H3`, `TH3_EA_T_T`, `TH3_T_H3_T_TEMP`, `TH3_T_T_H3_TEMP`,
`TH3_T_T_T_TEMP` shrink the boilerplate.
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