bozhang2820 commented on a change in pull request #30224:
URL: https://github.com/apache/spark/pull/30224#discussion_r516512066



##########
File path: 
external/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala
##########
@@ -1015,6 +1015,69 @@ abstract class AvroSuite
     }
   }
 
+  test("support user provided nullable avro schema " +
+    "for non-nullable catalyst schema without any null record") {
+    withTempPath { tempDir =>
+      val catalystSchema =
+        StructType(Seq(
+          StructField("Age", IntegerType, nullable = false),
+          StructField("Name", StringType, nullable = false)))
+
+      val avroSchema =
+        """
+          |{
+          |  "type" : "record",
+          |  "name" : "test_schema",
+          |  "fields" : [
+          |    {"name": "Age", "type": ["null", "int"]},
+          |    {"name": "Name", "type": ["null", "string"]}
+          |  ]
+          |}
+        """.stripMargin
+
+      val df = spark.createDataFrame(
+        spark.sparkContext.parallelize(Seq(Row(2, "Aurora"))), catalystSchema)
+
+      val tempSavePath = s"$tempDir/save/${UUID.randomUUID()}"

Review comment:
       Changed to use `tempDir`.




----------------------------------------------------------------
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]



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

Reply via email to