uros-db commented on code in PR #54037:
URL: https://github.com/apache/spark/pull/54037#discussion_r2740419161
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaSuite.scala:
##########
@@ -2204,6 +2207,238 @@ class ParquetSchemaSuite extends ParquetSchemaTest {
Seq("f1", "key_value", "value", "g2", "list",
"element", "h2"))))))))
))))))
+ // ==============================================================
+ // Tests for BINARY geospatial logical types (Geometry/Geography)
+ // ==============================================================
+
+ /** Parquet to Catalyst conversion for geospatial types. */
+
+ testParquetToCatalyst(
+ "Parquet to Catalyst - BINARY with GEOMETRY logical type annotation",
+ StructType(Seq(StructField("f1", GeometryType("OGC:CRS84")))),
+ """message root {
+ | optional binary f1 (GEOMETRY);
+ |}
+ """.stripMargin,
+ binaryAsString = false,
+ int96AsTimestamp = true)
+
+ testParquetToCatalyst(
+ "Parquet to Catalyst - BINARY with GEOGRAPHY logical type annotation",
+ StructType(Seq(StructField("f1",
+ GeographyType("OGC:CRS84", EdgeInterpolationAlgorithm.SPHERICAL)))),
+ """message root {
+ | optional binary f1 (GEOGRAPHY);
+ |}
+ """.stripMargin,
+ binaryAsString = false,
+ int96AsTimestamp = true)
+
+ testParquetToCatalyst(
+ "Parquet to Catalyst - BINARY with GEOMETRY logical type annotation with
binaryAsString",
+ StructType(Seq(StructField("f1", GeometryType("OGC:CRS84")))),
+ """message root {
+ | optional binary f1 (GEOMETRY);
+ |}
+ """.stripMargin,
+ binaryAsString = true,
+ int96AsTimestamp = true)
+
+ testParquetToCatalyst(
+ "Parquet to Catalyst - BINARY with GEOGRAPHY logical type annotation with
binaryAsString",
+ StructType(Seq(StructField("f1",
+ GeographyType("OGC:CRS84", EdgeInterpolationAlgorithm.SPHERICAL)))),
+ """message root {
+ | optional binary f1 (GEOGRAPHY);
+ |}
+ """.stripMargin,
+ binaryAsString = true,
+ int96AsTimestamp = true)
+
+ test("Parquet to Catalyst - GEOGRAPHY with explicit algorithm") {
+ val parquetSchema = Types.buildMessage()
+ .addField(
+ Types.primitive(BINARY, Repetition.OPTIONAL)
+ .as(geographyType("OGC:CRS84",
ParquetEdgeInterpolationAlgorithm.SPHERICAL))
Review Comment:
Actually, it seems that it does:
https://github.com/apache/parquet-java/blob/master/parquet-column/src/main/java/org/apache/parquet/schema/LogicalTypeAnnotation.java,
so I updated the tests accordingly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]