Fokko commented on a change in pull request #26780: [SPARK-27506][SQL] Allow 
deserialization of Avro data using compatible schemas 
URL: https://github.com/apache/spark/pull/26780#discussion_r356199894
 
 

 ##########
 File path: 
external/avro/src/test/scala/org/apache/spark/sql/avro/AvroFunctionsSuite.scala
 ##########
 @@ -153,4 +153,79 @@ class AvroFunctionsSuite extends QueryTest with 
SharedSparkSession {
       assert(df.collect().map(_.get(0)) === Seq(Row("one"), Row("two"), 
Row("three"), Row("four")))
     }
   }
+
+  test("SPARK-27506: roundtrip in to_avro and from_avro with different 
compatible schemas") {
+    val df = spark.range(10).select(
+      struct('id.as("col1"), 'id.cast("string").as("col2")).as("struct")
+    )
+    val avroStructDF = df.select(functions.to_avro('struct).as("avro"))
+    val actualAvroSchema = s"""
+                              |{
+                              |  "type": "record",
+                              |  "name": "struct",
+                              |  "fields": [
+                              |    {"name": "col1", "type": "int"},
+                              |    {"name": "col2", "type": "string"}
+                              |  ]
+                              |}
 
 Review comment:
   I've fixed this, but something looks off with Github

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to