Repository navigation
Conversation
…type Setting geoparquet.version to a 2.x version now writes the layout that GeoParquet 2.0 requires. The option used to change only the version string in the file metadata. A geometry column carries the GEOMETRY logical type, with the CRS as a property of the type: absent for OGC:CRS84, authority:code for a CRS with an identifier, inline PROJJSON for one without, and srid:0 for an unknown CRS. The GeoParquet metadata repeats the CRS as PROJJSON. Geometries are stored as ISO WKB, which the logical type requires; the writer used the EWKB flag bit for a Z coordinate. The Parquet library writes geospatial statistics for each row group once the column is annotated, so no covering column is generated. The Spark schema metadata of such a file keeps the native geometry type, as Spark's own writer does, so that Spark 4.2's Parquet reader returns a geometry column. A native Spark geometry type names the SRID of the column. A GeometryUDT column has an SRID on each geometry only, so for now a 2.x write of such a column needs geoparquet.crs. The Parquet library of Spark 3.5 and 4.0 has no GEOMETRY type, and a 2.x write is rejected on the driver there. The default version stays 1.1.0. Any version string that is not 2.x is written as before.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Did you read the Contributor Guide?
Is this PR related to a ticket?
[GH-XXX] my subject. Part of Update GeoParquet writer and reader to support GeoParquet 2.0.0 #3146. This is the second PR for GeoParquet 2.0, after [GH-3146] Read Parquet GEOMETRY columns in the GeoParquet reader #3544, so it does not close the issue.What changes were proposed in this PR?
Setting
geoparquet.versionto a 2.x version used to change only the version string in thegeometadata. It now writes the layout GeoParquet 2.0 requires, on Spark 4.1 and 4.2:GEOMETRYlogical type of the Parquet format, and the CRS is a property of that type: absent for OGC:CRS84,authority:codefor a CRS with an identifier, inline PROJJSON for a CRS without one, andsrid:0for an unknown CRS. Thegeometadata repeats the CRS as PROJJSON, ornullfor an unknown CRS.geoparquet.coveringstill declares a covering column the user provides.spark.read.parquetreturns a geometry column for these files.Limits of this PR:
1.1.0. A version string whose major part is not2is written as before.GeometryUDTcolumn (Spark 4.1) has an SRID on each geometry only, so a 2.x write of such a column needsgeoparquet.crsorgeoparquet.crs.<column_name>for now. Taking the CRS from the data is the next PR.GEOMETRYtype. A 2.x write is rejected on the driver there, with a message that namesgeoparquet.version1.1.0as the alternative.Not in this PR: the default version, CRS inference for
GeometryUDTcolumns, geography columns, and reading on Spark 3.5/4.0.How was this patch tested?
GeoParquetNativeTypesSuitehas a new block that writes 2.x files and reads the footer back: theGEOMETRYannotation and itscrsfor the default CRS, an EPSG CRS, an unknown CRS and a CRS without an identifier, the CRS taken from the SRID of a native column, the row-group geospatial statistics, ISO WKB for a geometry with Z, thegeometadata, a 1.1.0 file that keeps plain binary and its covering column, and the rejection on a Parquet library without the geospatial types.ParquetGeospatialTypesTestcovers the mapping from a CRS to thecrsproperty and the version rule.NativeGeoParquetCrsSuitein thespark-4.2module reads Sedona's 2.0 output with Spark's own Parquet reader for SRID 4326, 3857 and 0.The GeoParquet suites pass locally on Spark 4.1 / Scala 2.13, Spark 4.2 / Scala 2.13 (including the GeoParquet suites of the
spark-4.2module) and Spark 3.5 / Scala 2.12.Did this PR include necessary documentation updates?