You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/12/10 18:19:16 UTC

[GitHub] [spark] Fokko commented on a change in pull request #26780: [SPARK-27506][SQL] Allow deserialization of Avro data using compatible schemas

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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org