gengliangwang commented on a change in pull request #33413:
URL: https://github.com/apache/spark/pull/33413#discussion_r676604390



##########
File path: 
external/avro/src/test/scala/org/apache/spark/sql/avro/AvroLogicalTypeSuite.scala
##########
@@ -148,6 +155,38 @@ abstract class AvroLogicalTypeSuite extends QueryTest with 
SharedSparkSession {
     }
   }
 
+  test("Logical type: local_timestamp_millis") {
+    withTempDir { dir =>
+      val expected = timestampInputData.map(t =>
+        
Row(DateTimeUtils.microsToLocalDateTime(DateTimeUtils.millisToMicros(t._3))))
+      val timestampAvro = timestampFile(dir.getAbsolutePath)
+      val df = 
spark.read.format("avro").load(timestampAvro).select('local_timestamp_millis)
+
+      checkAnswer(df, expected)
+
+      withTempPath { path =>
+        df.write.format("avro").save(path.toString)
+        checkAnswer(spark.read.format("avro").load(path.toString), expected)
+      }
+    }
+  }
+
+  test("Logical type: local_timestamp_micros") {
+    withTempDir { dir =>
+      val expected = timestampInputData.map(t =>
+        
Row(DateTimeUtils.microsToLocalDateTime(DateTimeUtils.millisToMicros(t._4))))
+      val timestampAvro = timestampFile(dir.getAbsolutePath)
+      val df = 
spark.read.format("avro").load(timestampAvro).select('local_timestamp_micros)
+
+      checkAnswer(df, expected)
+
+      withTempPath { path =>
+        df.write.format("avro").save(path.toString)
+        checkAnswer(spark.read.format("avro").load(path.toString), expected)

Review comment:
       let's verify the schema as well




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

Reply via email to