Repository navigation
Support the Parquet GEOMETRY and GEOGRAPHY logical types - #125131
Conversation
Add the `have_geospatial_statistics` and `geospatial_statistics` (bounding box and geometry type codes) fields to the column chunks of `row_groups`. They are present for columns with the Parquet `GEOMETRY` and `GEOGRAPHY` logical types. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reading: `BYTE_ARRAY` columns annotated with `GEOMETRY` or `GEOGRAPHY` are decoded from WKB into ClickHouse geo types, also without the GeoParquet `geo` metadata. The geometry type is taken from the explicitly requested type, then from the `geo` metadata, then from `GeospatialStatistics` if all column chunks list the same single 2D type; otherwise `Geometry`. A `String` type hint returns the raw WKB. Controlled by `input_format_parquet_allow_geoparquet_parser`. `GEOGRAPHY` is read into the same types (edge interpolation and CRS are not represented). Min/max statistics and the column index of these columns are ignored, as the sort order is undefined. Spatial pruning by `GeospatialStatistics` now also handles a bounding box that crosses the antimeridian (`xmin > xmax`). Writing: WKB geo columns are annotated with `GEOMETRY` (default CRS) and get `GeospatialStatistics` instead of min/max statistics and the column index. A `Geometry` column is now also described in the `geo` metadata, with an empty list of geometry types. New setting `output_format_parquet_geometry_logical_type` (enabled by default, disabled by `compatibility` before 26.10). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reading files written by Arrow C++ (`pyarrow`) and the files from apache/parquet-testing `data/geospatial/` (`crs-default.parquet`, `crs-geography.parquet`, `crs-srid.parquet`, `geography-points.parquet`), round trip of ClickHouse geo types, written metadata and statistics, settings, and spatial pruning by `GeospatialStatistics`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Readers that do not know the `GEOMETRY` logical type cannot open the whole file: Arrow C++ and `pyarrow` before version 20 fail with "Metadata contains Thrift LogicalType that is not recognized", and older parquet-java / Spark 3.x are likely affected as well. Disable the setting by default and describe the default write behavior in the documentation as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [7ee673a] Summary: ✅
AI ReviewSummaryAdds native Parquet Missing context / blind spots
Final Verdict✅ Approve. No new inline findings or thread changes are needed. |
Address review: when `GeospatialStatistics` of a `GEOMETRY` / `GEOGRAPHY` column list a geometry type with Z and/or M coordinates (ISO WKB codes 1000+), `parseWKBFormat` cannot decode the values. Return the raw WKB bytes as `String` for such columns instead of inferring `Geometry` and throwing during decoding. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dictionary page of a Parquet column chunk with only NULLs has no values.
For a `GEOMETRY` column decoded into `Geometry`, `GeoConverter::convertColumn`
was called with `num_values = 0` and evaluated `offsets[num_values - 1]`,
which is a pointer overflow reported by UBSan and aborted the
`05360_parquet_geometry_logical_type_write` test in sanitizer builds:
Decoding.cpp:2401:5: runtime error: addition of unsigned offset to 0x... overflowed to 0x...
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=a2db6624ac81361b9af2c6fc9424a0068c3b6040&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20targeted%29
#125131
Co-Authored-By: Claude Opus 5.5 <[email protected]>
With `output_format_parquet_geometry_logical_type`, the column carries the `GEOMETRY` logical type with its default CRS (`OGC:CRS84`), while the `geo` metadata said `"crs": "EPSG:4326"`, which has a different axis order. Omit `crs` from the `geo` metadata in this case: in GeoParquet an omitted `crs` means `OGC:CRS84` as well, so both kinds of metadata agree. Without the logical type, the metadata is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=1df2112fbe60a0079d6e7af19de8b3d87f488ff7&name_0=PR&name_1=Integration%20tests%20%28arm_binary%2C%201%2F4%29 ( |
|
The fix is #125448 (mine, merged 2026-10-13 01:47Z). This run predates it: the workflow was triggered at 2026-10-12 18:48Z, so the tested tree did not have it. What happened in this job: on xdist worker Since the merge, all 20 failures of this test were in workflows triggered before 01:47Z, each with the interop module on the same worker; master has 85 passes and no failure on a tree with the fix. The new head cfc6f7c is tested merged with current master, so it includes the fix. |
Build profile diff (arm_release)Commit See the job log for details. |
…gical-type # Conflicts: # src/Client/BuzzHouse/Generator/SessionSettings.cpp # src/Core/FormatFactorySettings.h # src/Formats/FormatFactory.cpp # src/Formats/FormatSettings.h # src/Processors/Formats/Impl/Parquet/Write.h # src/Processors/Formats/Impl/ParquetBlockOutputFormat.cpp # src/Processors/Formats/Impl/ParquetV3BlockInputFormat.cpp
|
🕵 @groeneai, thanks for the explanation of the Iceberg timeout; confirmed that #125448 is on master. @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=cfc6f7c5d1165b1f3842bfcd7150a2cf8e9fda7b&name_0=PR&name_1=AST%20fuzzer%20%28amd_debug%2C%20targeted%29 ( The branch is now merged with the current master (conflicts with the new |
|
The fix is #125126 (mine, merged 2026-10-13 15:34Z). This run predates it: the workflow for The abort is the reduced All 4 CIDB occurrences after the merge (17:31Z to 18:27Z) come from runs created before it, and there are none since 2026-10-13 18:27Z. The current head |
Address review: - A bounding box crossing the antimeridian (`xmin > xmax`) bounds the vertices, but not the straight segments used by the Cartesian predicates, e.g. `polygonsIntersectCartesian`. Use the wrapped X range only if the column chunk is known to contain only points and multipoints. - A NULL read into a non-nullable geo type becomes the default value, e.g. the point (0, 0), which is not covered by the bounding box. Do not prune if the column chunk can have NULLs and the query bounding box contains (0, 0). Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=ec568b153c057b9bce2147e3f5b9bd89a419dd01&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%202%2F2%29 ( The The two review comments about |
|
Acknowledged. No fix for |
|
The fix for |
…converts coordinates If a geometry column is requested with a type that changes coordinates, e.g. `Tuple(UInt8, UInt8)` instead of `Point`, the bounding box from the statistics no longer bounds the values, so a matching row group could be pruned. Use spatial pruning only if the requested type is raw WKB `String` or has `Float64` coordinates. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Parquet geospatial column read as `Nullable(Point)` lost its null map, so NULLs silently became `(0,0)`. `Point` can be inside `Nullable`, so keep the null map when `Nullable` is requested explicitly. Add regressions for this and for spatial pruning with a narrowing coordinate type. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged master and addressed both review threads (6415d28, e1a7627). The remaining CI failures are unrelated to this PR:
|
The release branch for 26.10 was created in #126122 Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts: # src/Processors/Formats/Impl/Parquet/SchemaConverter.cpp
…ad as `Point` `pointInPolygon` accepts the `Array(Point)` representation of a `MultiPoint` as a polygon and connects its vertices, so a bounding box crossing the antimeridian does not bound it. Use the wrapped X range only if `geospatial_types` lists only points and the column is read as a `Tuple`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…`GEOGRAPHY` logical types The files from `data/geospatial/` are now readable: the ones with Z/M geometries as raw WKB `String`. https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=3c74c1e0fb8b746798a756680292aff874c25c0a&name_0=PR&name_1=Stateless%20tests%20%28amd_debug%2C%20parallel%29 #125131 Co-Authored-By: Claude Opus 5.5 <[email protected]>
… `GeospatialStatistics` After #124364 the Parquet footer is parsed without `RowGroup::columns`, so `getGeoTypeFromGeospatialStatistics` saw no column chunks and inferred `Geometry` for every column with the `GEOMETRY` or `GEOGRAPHY` logical type. `SchemaConverter` now takes the `FileFooter` and parses the chunks of only that column. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 Merged master (6e4f724). After #124364 the Parquet footer is parsed without column chunks, so a column with the @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=125131&sha=8d1e2e8335aad82bbb562247cd21b51ba4b69c93&name_0=PR&name_1=Storage%20memory%20check ( |
|
The fix is already open: #121545 (mine), the quiescent checkpoint agreed on #113201. Before each heap dump the profiler waits until the background executor task metrics are zero, so a finished mutation task is no longer charged to the next scenario.
On the master arm the finished The master arm runs the merge-base binary ( |
Support the Parquet
GEOMETRYandGEOGRAPHYlogical types (https://github.com/apache/parquet-format/blob/master/Geospatial.md) in the native Parquet reader and writer.Reading: columns annotated with
GEOMETRYorGEOGRAPHYare decoded from WKB into ClickHouse geo types, even without GeoParquetgeometadata. The type comes from an explicit type hint, then from the GeoParquet metadata, then fromGeospatialStatistics(if all column chunks list one 2D type), and isGeometryotherwise. IfGeospatialStatisticslist a geometry type with Z and/or M coordinates (not supported by ClickHouse geo types), the column is read as raw WKBString. AStringhint returns raw WKB.GEOGRAPHYis read into the same types; CRS and edge interpolation are not represented. Min/max statistics of these columns are ignored, as the spec requires. Spatial pruning bygeospatial_statistics.bboxnow also handles bounding boxes that cross the antimeridian (xmin > xmax).Writing: the new setting
output_format_parquet_geometry_logical_typeannotates WKB geo columns withGEOMETRYand writesGeospatialStatistics(bbox and geometry types) instead of min/max statistics and the column index. AGeometrycolumn is then also described in thegeometadata. The setting is disabled by default, because readers that don't know the logical type (Arrow C++ / pyarrow before 20) can't open the whole file.The
ParquetMetadataformat now showsgeospatial_statistics.Tests include reference files from apache/parquet-testing
data/geospatial/(written by Arrow C++ and DataFusion) and pyarrow-written files.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Support the Parquet
GEOMETRYandGEOGRAPHYlogical types: such columns are read as ClickHouse geo types, andGeospatialStatisticsare used for spatial pruning. Geo columns can be written with theGEOMETRYlogical type andGeospatialStatisticswith the new settingoutput_format_parquet_geometry_logical_type.🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/125131]
Version info
26.11.1.383-master(included in26.11and later)