You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Two details from reproducing the first two items on 0.12.0 and on main (068aae5), in case they help scope the work. Line numbers are from main.
Item 1 (unquoted form) also needs the emit side. Reading is only half of it: PyIceberg writes the quoted form, which is not the spec form ("geometry(srid:4326)", "geography(srid:4326, spherical)" in the JSON serialization table of format/spec.md):
"geometry('srid:4326')" -> GeometryType(crs='srid:4326')
'geometry(srid:4326)' -> ValidationError: Could not parse geometry(srid:4326) into a GeometryType
'geometry(EPSG:7415)' -> ValidationError: Could not parse geometry(EPSG:7415) into a GeometryType
'geography(srid:4326, spherical)' -> ValidationError: Could not parse geography(srid:4326, spherical) into a GeographyType
emitted: "geometry('srid:4326')" "geography('srid:4326', 'planar')"
pyiceberg.exceptions.ValidationError: Could not parse geometry(srid:4326) into a GeometryType
Java's GEOMETRY_PARAMETERS pattern (Types.java lines 67-71 on apache/iceberg main) does not strip quotes, so it reads PyIceberg's output as CRS 'srid:4326' with the quotes included. Java writes geometry(%s) / geography(%s, %s) (lines 632 and 709). This matches the split @moomindani proposed on #3530: read side there, emit side as a follow-up.
Item 2 is a hard error, not just plain binary. Because the file column resolves to BinaryType, _cast_if_needed calls promote(BinaryType, GeometryType), and that raises (pyiceberg/io/pyarrow.py line 2036, pyiceberg/schema.py line 1691). It happens on write as well as read. Without geoarrow-pyarrow, writing a binary or large_binary WKB column through PyIceberg's own writer fails like this:
File "pyiceberg/io/pyarrow.py", line 1937, in _to_requested_schema
File "pyiceberg/io/pyarrow.py", line 2036, in _cast_if_needed
File "pyiceberg/schema.py", line 1691, in _
pyiceberg.exceptions.ResolveError: Cannot promote an binary to geometry
Scanning a Parquet file that stores WKB as a plain BYTE_ARRAY column with the matching field id fails with the same ResolveError in ArrowScan.to_table. With geoarrow-pyarrow installed, a geoarrow.wkb input column is rejected earlier with UnsupportedPyArrowTypeException: Column 'geom' has an unsupported type: extension<geoarrow.wkb<WkbType>>. So as far as I can tell, no input form round-trips today. That differs from mkdocs/docs/geospatial.md, which says that without geoarrow-pyarrow "geometry and geography are written as binary in Parquet while the Iceberg schema still preserves the spatial type". An end-to-end write/read test for each of the three column forms would catch this. The existing geo tests in tests/io/test_pyarrow.py only cover the type conversion.
I have a small patch for item 1, read and emit side. It makes the quotes optional in GEOMETRY_REGEX / GEOGRAPHY_REGEX, keeps accepting the quoted form so older type strings still parse, emits the unquoted form, and adds parametrized tests to tests/test_types.py (308 pass; the new tests fail on main). It does not yet do the case-insensitive matching. I'm happy to open it as the emit-side follow-up once #3530 settles the read side, or to leave it to @moomindani if that's already in progress.
This report was prepared with an AI coding agent (Claude Code) and reproduced before posting by me.
On the checklist item "Make sure the metrics evaluators don't read spec-encoded bounds (x, y[, z, m]) as WKB": I looked into this, and I think the evaluators are already safe on main. Along the way I found a related crash in inspect.
Metrics evaluators: no path reads geo bounds today
No literal type in pyiceberg/expressions/literals.py converts to geometry/geography. So EqualTo, NotEqualTo, LessThan/LessThanOrEqual, GreaterThan/GreaterThanOrEqual, In, NotIn, StartsWith and NotStartsWith on a geo column all fail at bind time with TypeError: Cannot convert BinaryLiteral into geometry. BindVisitor rejects predicates that are already bound.
IsNaN/NotNaN bind to AlwaysFalse/AlwaysTrue, and IsNull/NotNull only use value/null counts.
End to end with the integration image (Spark 4.1.3, Iceberg 1.12.0), Spark writes no lower/upper bounds for geometry/geography columns. So there are currently no geo bounds to misread.
So nothing needs fixing in _InclusiveMetricsEvaluator/_StrictMetricsEvaluator right now. The item is still worth keeping in mind for spatial predicates (e.g. st_intersects), since those would be the first to decode the x:y[:z:m] bounds.
inspect.files() crashes on geo tables when geoarrow-pyarrow is installed
Repro: with spark.sql.geospatial.enabled=true, Spark creates a V3 table (id BIGINT, geom GEOMETRY(4326), geog GEOGRAPHY(4326)) and inserts three points plus a NULL row. PyIceberg then loads the table and calls table.inspect.files():
File "pyiceberg/table/inspect.py", line 790, in _get_files_from_manifest
return pa.Table.from_pylist(
...
pyarrow.lib.ArrowNotImplementedError: extension
_get_files_schema types the readable_metricslower_bound/upper_bound fields with schema_to_pyarrow(field_type) (inspect.py:816-817). For geo columns that is the geoarrow.wkb extension type, and pa.Table.from_pylist can't build it from Python values. This fails even though every bound is None. Without geoarrow installed, the type falls back to large_binary and files() works. entries() builds the same struct (inspect.py:178-179), so it is probably affected too, but I haven't run it.
When bounds are present, they are spec-encoded x:y[:z:m] points rather than WKB, so labelling them geoarrow.wkb would be wrong anyway. Plain binary for geo bound fields looks like the simplest fix. Would that work, or would you rather decode them into something more readable? I'm happy to open a PR either way.
Note: on main, loading a Spark-written geo table currently fails earlier, with ValidationError: Could not parse geometry(OGC:CRS84) into a GeometryType (item 1), and a full scan fails with ResolveError: Cannot promote an binary to geometry. For the repro I patched the type regexes locally to accept the unquoted CRS. #4422 covers loading and doesn't touch inspect.py, so I'd build any fix on top of it.
A correction to my comment above. I wrote that "there are currently no geo bounds to misread". That's too broad: it only holds for data written by Spark with Iceberg 1.12.0, the version in the integration image.
Iceberg 1.12.0 already includes Parquet: Compute geometry bounding box metrics iceberg#17161. That PR makes Iceberg's generic Parquet writer (BaseParquetWriter) emit XY bounds for geometry columns, serialized as GeospatialBound points (x:y).
inspect.files() / entries(): the representation question matters now rather than later. Geometry files from the generic writer can already carry real x:y bounds, which shouldn't be typed as WKB in readable_metrics.
Activity
quinncheong commentedon Oct 6, 2026
Two details from reproducing the first two items on 0.12.0 and on
main(068aae5), in case they help scope the work. Line numbers are frommain.Item 1 (unquoted form) also needs the emit side. Reading is only half of it: PyIceberg writes the quoted form, which is not the spec form (
"geometry(srid:4326)","geography(srid:4326, spherical)"in the JSON serialization table of format/spec.md):Java's
GEOMETRY_PARAMETERSpattern (Types.javalines 67-71 on apache/iceberg main) does not strip quotes, so it reads PyIceberg's output as CRS'srid:4326'with the quotes included. Java writesgeometry(%s)/geography(%s, %s)(lines 632 and 709). This matches the split @moomindani proposed on #3530: read side there, emit side as a follow-up.Item 2 is a hard error, not just plain binary. Because the file column resolves to
BinaryType,_cast_if_neededcallspromote(BinaryType, GeometryType), and that raises (pyiceberg/io/pyarrow.py line 2036, pyiceberg/schema.py line 1691). It happens on write as well as read. Without geoarrow-pyarrow, writing a binary or large_binary WKB column through PyIceberg's own writer fails like this:Scanning a Parquet file that stores WKB as a plain BYTE_ARRAY column with the matching field id fails with the same
ResolveErrorinArrowScan.to_table. With geoarrow-pyarrow installed, ageoarrow.wkbinput column is rejected earlier withUnsupportedPyArrowTypeException: Column 'geom' has an unsupported type: extension<geoarrow.wkb<WkbType>>. So as far as I can tell, no input form round-trips today. That differs from mkdocs/docs/geospatial.md, which says that without geoarrow-pyarrow "geometry and geography are written as binary in Parquet while the Iceberg schema still preserves the spatial type". An end-to-end write/read test for each of the three column forms would catch this. The existing geo tests in tests/io/test_pyarrow.py only cover the type conversion.I have a small patch for item 1, read and emit side. It makes the quotes optional in
GEOMETRY_REGEX/GEOGRAPHY_REGEX, keeps accepting the quoted form so older type strings still parse, emits the unquoted form, and adds parametrized tests to tests/test_types.py (308 pass; the new tests fail on main). It does not yet do the case-insensitive matching. I'm happy to open it as the emit-side follow-up once #3530 settles the read side, or to leave it to @moomindani if that's already in progress.This report was prepared with an AI coding agent (Claude Code) and reproduced before posting by me.
Make DuckDB 1.5.6 the tested version throughout; drop 1.5.5 references
Re-verify on DuckDB 1.5.6 (V3 geometry pruning, L3); pyiceberg 0.12.0…
Re-verify on DuckDB 2.0.0 (V3 geometry L3, plain ST_Intersects prunes…
FurkhanShaikh commentedon Nov 21, 2026
On the checklist item "Make sure the metrics evaluators don't read spec-encoded bounds (x, y[, z, m]) as WKB": I looked into this, and I think the evaluators are already safe on
main. Along the way I found a related crash ininspect.Metrics evaluators: no path reads geo bounds today
pyiceberg/expressions/literals.pyconverts togeometry/geography. SoEqualTo,NotEqualTo,LessThan/LessThanOrEqual,GreaterThan/GreaterThanOrEqual,In,NotIn,StartsWithandNotStartsWithon a geo column all fail at bind time withTypeError: Cannot convert BinaryLiteral into geometry.BindVisitorrejects predicates that are already bound.IsNaN/NotNaNbind toAlwaysFalse/AlwaysTrue, andIsNull/NotNullonly use value/null counts.So nothing needs fixing in
_InclusiveMetricsEvaluator/_StrictMetricsEvaluatorright now. The item is still worth keeping in mind for spatial predicates (e.g.st_intersects), since those would be the first to decode thex:y[:z:m]bounds.inspect.files()crashes on geo tables whengeoarrow-pyarrowis installedRepro: with
spark.sql.geospatial.enabled=true, Spark creates a V3 table(id BIGINT, geom GEOMETRY(4326), geog GEOGRAPHY(4326))and inserts three points plus a NULL row. PyIceberg then loads the table and callstable.inspect.files():_get_files_schematypes thereadable_metricslower_bound/upper_boundfields withschema_to_pyarrow(field_type)(inspect.py:816-817). For geo columns that is thegeoarrow.wkbextension type, andpa.Table.from_pylistcan't build it from Python values. This fails even though every bound isNone. Without geoarrow installed, the type falls back tolarge_binaryandfiles()works.entries()builds the same struct (inspect.py:178-179), so it is probably affected too, but I haven't run it.When bounds are present, they are spec-encoded
x:y[:z:m]points rather than WKB, so labelling themgeoarrow.wkbwould be wrong anyway. Plain binary for geo bound fields looks like the simplest fix. Would that work, or would you rather decode them into something more readable? I'm happy to open a PR either way.Note: on
main, loading a Spark-written geo table currently fails earlier, withValidationError: Could not parse geometry(OGC:CRS84) into a GeometryType(item 1), and a full scan fails withResolveError: Cannot promote an binary to geometry. For the repro I patched the type regexes locally to accept the unquoted CRS. #4422 covers loading and doesn't touchinspect.py, so I'd build any fix on top of it.FurkhanShaikh commentedon Nov 21, 2026
A correction to my comment above. I wrote that "there are currently no geo bounds to misread". That's too broad: it only holds for data written by Spark with Iceberg 1.12.0, the version in the integration image.
BaseParquetWriter) emit XY bounds for geometry columns, serialized asGeospatialBoundpoints (x:y).How this affects the two points above:
inspect.files()/entries(): the representation question matters now rather than later. Geometry files from the generic writer can already carry realx:ybounds, which shouldn't be typed as WKB inreadable_metrics.