leesf commented on a change in pull request #960: [HUDI-307] Adding type test 
for timestamp,date & decimal
URL: https://github.com/apache/incubator-hudi/pull/960#discussion_r336386827
 
 

 ##########
 File path: hudi-spark/src/test/scala/DataSourceTest.scala
 ##########
 @@ -63,83 +74,161 @@ class DataSourceTest extends AssertionsForJUnit {
     fs = FSUtils.getFs(basePath, spark.sparkContext.hadoopConfiguration)
   }
 
+  @Test def testCopyOnWriteExtraTypesStorage() {
+    // Insert Operation
+    val records1 = DataSourceTestUtils
+      .convertToStringList(dataGen.generateExtraTypesInserts("000", 100))
+      .toList
+
+    val inputDF1: Dataset[Row] =
+      spark.read
+        .schema(HoodieTestDataGenerator.schemaExtraTypes)
+        .json(spark.sparkContext.parallelize(records1, 2))
+
+    inputDF1.write
+      .format("org.apache.hudi")
+      .options(commonOpts)
+      .option(
+        DataSourceWriteOptions.OPERATION_OPT_KEY,
+        DataSourceWriteOptions.INSERT_OPERATION_OPT_VAL
+      )
+      .mode(SaveMode.Overwrite)
+      .save(basePath)
+
+    // Read RO View
+    val hoodieROViewDF1 = spark.read
+      .format("org.apache.hudi")
+      .load(basePath + "/*/*/*/*");
+
+    hoodieROViewDF1.dtypes.foreach {
+      case (columnName, readType) =>
+        val maybeField =
+          HoodieTestDataGenerator.schemaExtraTypes.find(_.name == columnName)
+        maybeField.foreach(
+          structField => assertEquals(structField.dataType.toString, readType)
 
 Review comment:
   https://api.travis-ci.org/v3/job/599506767/log.txt

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

Reply via email to