Repository navigation
fix: preserve geospatial SRIDs in column type names - #583
Conversation
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Low
Looks good, with 1 low concern. GEOMETRY/GEOGRAPHY SRID names now come through the shared Arrow mapper and the Thrift override path, without changing values, scan types or lengths, and unit and e2e tests cover both backends.
There was a problem hiding this comment.
🔀 Cross-reviewed: two independent reviews (Claude Opus 5.5 · GPT-6.1 Sol), checked by a judge model (Claude Sonnet 5.5).
Verdict: 1 Nit
Looks good: no findings. Both backends now take geospatial SQL names from Spark:DataType:SqlName. Scan types, lengths and binary-scanner selection stay the same. Unit tests and live E2E tests (registered in the nightly runs) cover SRIDs, fallbacks and concurrent reads.
This overview is Claude Opus 5.5's initial take; GPT-6.1 Sol added findings it doesn't mention — see the findings below.
Other findings
- ⚪ Nit — The 'geography kernel' benchmark case sets only databricks.type_name and databricks.type_text, not Spark:DataType:SqlName. LogicalGeospatialType reads only SqlName, so the case measures the plain STRING path instead of the geospatial mapping. Add the SqlName key (for example GEOGRAPHY(4326)) to that case's metadata. (Found by GPT-6.1 Sol · confirmed by the judge)
|
Fixed the review-body benchmark nit in 4acfe13: the geography-kernel fixture now includes This comment was generated with GitHub MCP. |
aakash-saravanan-db
left a comment
There was a problem hiding this comment.
LGTM.
Non-blocking: could we assert the native EWKB contents, including SRIDs, and add a GEOMETRY(ANY) case containing different per-row SRIDs? That would verify that metadata preserves the declared ANY while each value retains its own SRID.
|
Addressed in 575d9d2 (test-only). The shared live helper now compares exact EWKB bytes for SRIDs 0/4326/3857 and checks that This comment was generated with GitHub MCP. |
Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
Thrift sends only Spark:DataType:SqlName, and the kernel writes it from the manifest type_text in the same block as type_name (src/reader/mod.rs since v1.2.0), so one key gives the same SRID-qualified names on both backends and drops the second precedence order that differed from logicalTypeName. Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
Include Spark:DataType:SqlName in the geography benchmark and reject incomplete kernel-shaped benchmark fixtures before timing them. Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
Check exact native geospatial bytes and alternate SRIDs under GEOMETRY(ANY) in inline and CloudFetch results on both backends. Signed-off-by: Vu Anh Phung <[email protected]> Co-authored-by: Isaac <[email protected]>
575d9d2 to
2ed88c0
Compare
ColumnType.DatabaseTypeName()drops GEOMETRY/GEOGRAPHY identity and SRIDs on both backends: Thrift exposes the physical STRING type, and the Go kernel mapper discards the full SQL name. Reuse the existing VARIANT override cache and shared Arrow mapper to preserve top-level server SQL names, includingGEOMETRY(ANY). Both backends read onlySpark:DataType:SqlName; the kernel writes it from manifesttype_textalongsidetype_name. Values, scan types, lengths, raw Arrow schemas and missing/unreadable-schema fallbacks stay unchanged.Behavior change: With
WithEnableGeoSpatialSupport(true)(enableGeoSpatialSupport=true, available since v1.17.0), bareGEOMETRY/GEOGRAPHYmetadata becomes SRID-qualified, for exampleGEOMETRY(0),GEOMETRY(ANY)orGEOGRAPHY(4326). Default string mode changes fromSTRINGto the same qualified names. Match the family before(when choosing a decoder; EWKT/EWKB values do not change.Rebased onto main 9d8c6c8 as 2ed88c0, preserving all six commit messages/trailers; range-diff changes only the changelog and nightly test union. Fresh
make test: 1,813 total tests, ten existing credential skips, no failures;make lint(zero issues), pure-Go/kernel-tagged builds and arrowscan/root race pass. Live Thrift (3.765s) and SEA text/native (6.122s) pass without skips, also under-race(12.749s total), including inline, empty, NULL-only and 100,000-row CloudFetch results. Exact EWKB assertions cover SRIDs 0/4326/3857 and alternatingGEOMETRY(ANY)rows; the earlier wrong-payload negative control and external-module consumer smoke tests remain applicable. The full published-v1.4.0 kernel suite's single capability-test failure (four subcases) and three generated-file formatting differences reproduce on pristine main 9d8c6c8; no unrelated fixes.Earlier metadata benchmarks use identical corrected kernel fixtures on the original base c1f2469 and this branch, three alternating fresh processes per version and six samples per process (
benchstat, 18 samples each). Median base → branch: geography-kernel field 70.17 → 82.07ns; 400-column geo-free schema 28.86 → 23.96µs (-16.97%, zero allocations); cold Thrift metadata 1.660 → 1.787µs (+208B, one allocation/result); cached lookup 10.005 → 8.969ns. Other affected single-field cases add 5.5–9.5ns without allocations. Fixtures include all three actual kernel metadata keys and validate consistency before timing. The rebase changes no approved production code and adds no runtime overhead; these are historical measurements, not rerun comparisons against 9d8c6c8. Live timings use a shared warehouse, not a controlled comparison.Cross-driver state
EnableGeoSpatialSupport=1by default, explicit disable reports STRING (DatabricksResultSetMetaData.java:625@840f3a4).thrift_backend.py:823,kernel/type_mapping.py:176@087b2bf); native support defaults false.DBSQLOperation.ts:298,KernelOperationBackend.ts:371@7667e36).src/reader/mod.rs:1020@8877579, since v1.2.0); no upgrade.kernel_result_set_metadata.cpp:114@b7fefd8).JDBC full SQL names are the model; Go deliberately retains existing value representations and reports type identity independently of native opt-in, like its VARIANT handling. Catalog APIs are not applicable to
database/sql; #328's native serialization negotiation remains out of scope.Adversarial review: converged in round 1; all four follow-ups addressed. The bot approved rebased head 2ed88c0 with no findings, including the maintainer-requested EWKB/mixed-SRID coverage. No unresolved review threads.
Fixes #474
This pull request and its description were written by Isaac.