Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import/export geoarrow.wkb extension type from/to GEOMETRY #485

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

paleolimbot
Copy link

@paleolimbot paleolimbot commented Jan 18, 2025

This PR implements conversion between DuckDB GEOMETRY and geoarrow.wkb when importing or exporting Arrow using duckdb/duckdb#15285 .

# build/duckdb -unsigned
v1.1.4-dev4679 0024e5d4be
Enter ".help" for usage hints.

# Because there's no good way to test this from a shell without an Arrow IPC reader
D FORCE INSTALL '/Users/dewey/gh/duckdb-nanoarrow/build/extension/nanoarrow/nanoarrow.duckdb_extension';
D LOAD httpfs;
D LOAD nanoarrow;

# Registration is opt-in
D SELECT * FROM read_arrow_stream2('https://github.com/geoarrow/geoarrow-data/releases/download/v0.1.0/ns-water-basin_point-wkb.arrow');
Not implemented Error:
Arrow Extension with configuration:
Extension Name: geoarrow.wkb
 not yet registered
D CALL register_geoarrow_extensions();
┌────────────┐
│ registered │
│  boolean   │
├────────────┤
│ true       │
└────────────┘
D SELECT * FROM read_arrow_stream2('https://github.com/geoarrow/geoarrow-data/releases/download/v0.1.0/ns-water-basin_point-wkb.arrow');

# Should work but doesn't!
INTERNAL Error:
Attempted to dereference unique_ptr that is NULL!

Stack Trace:

0        _ZN6duckdb9Exception6ToJSONENS_13ExceptionTypeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 448
1        _ZN6duckdb9ExceptionC2ENS_13ExceptionTypeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 504
2        _ZN6duckdb17InternalExceptionC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 252
3        _ZN6duckdb17InternalExceptionC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 100
4        _ZN6duckdb10unique_ptrINS_13ArrowTypeInfoENSt3__114default_deleteIS1_EELb1EE13AssertNotNullEb + 528
5        _ZNK6duckdb10unique_ptrINS_13ArrowTypeInfoENSt3__114default_deleteIS1_EELb1EEptEv + 156
6        _ZNK6duckdb9ArrowType11GetTypeInfoINS_15ArrowStringInfoEEERKT_v + 184
7        _ZN6duckdbL17ArrowToDuckDBBlobERNS_6VectorER10ArrowArrayRKNS_19ArrowScanLocalStateEyRKNS_9ArrowTypeExx + 732
8        _ZN6duckdbL19ColumnArrowToDuckDBERNS_6VectorER10ArrowArrayRNS_19ArrowArrayScanStateEyRKNS_9ArrowTypeExPNS_12ValidityMaskEy + 27196
9        _ZN6duckdbL19ColumnArrowToDuckDBERNS_6VectorER10ArrowArrayRNS_19ArrowArrayScanStateEyRKNS_9ArrowTypeExPNS_12ValidityMaskEy + 2568
10       _ZN6duckdb18ArrowTableFunction13ArrowToDuckDBERNS_19ArrowScanLocalStateERKNSt3__113unordered_mapIyNS_10shared_ptrINS_9ArrowTypeELb1EEENS3_4hashIyEENS3_8equal_toIyEENS3_9allocatorINS3_4pairIKyS7_EEEEEERNS_9DataChunkEyby + 7172
11       _ZN6duckdb18ArrowTableFunction17ArrowScanFunctionERNS_13ClientContextERNS_18TableFunctionInputERNS_9DataChunkE + 4308
12       _ZN6duckdb13ext_nanoarrow12_GLOBAL__N_116ReadArrowStream24ScanERNS_13ClientContextERNS_18TableFunctionInputERNS_9DataChunkE + 244

Closes #153.

@paleolimbot paleolimbot marked this pull request as draft January 18, 2025 05:54
@paleolimbot paleolimbot marked this pull request as ready for review January 19, 2025 05:28
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.

Representation of spatial types on export to ArrowArrayStream
1 participant