n3nash commented on a change in pull request #2927:
URL: https://github.com/apache/hudi/pull/2927#discussion_r629684346
##########
File path:
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkUtils.scala
##########
@@ -103,4 +106,34 @@ class TestHoodieSparkUtils {
assertEquals(files.sortWith(_.toString < _.toString),
indexedFilePaths.sortWith(_.toString < _.toString))
spark.stop()
}
+
+ @Test
+ def testCreateRdd(@TempDir tempDir: File): Unit = {
+ val spark = SparkSession.builder
+ .appName("Hoodie Datasource test")
+ .master("local[2]")
+ .config("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
+ .getOrCreate
+
+ val schema = DataSourceTestUtils.getStructTypeExampleSchema
+ val structType = AvroConversionUtils.convertAvroSchemaToStructType(schema)
+ var records = DataSourceTestUtils.generateRandomRows(5)
+ var recordsSeq = convertRowListToSeq(records)
+ val df1 =
spark.createDataFrame(spark.sparkContext.parallelize(recordsSeq), structType)
+
+ var genRecRDD = HoodieSparkUtils.createRdd(df1, schema,"test_struct_name",
"test_namespace")
+ genRecRDD.collect()
+
+ val evolSchema = DataSourceTestUtils.getStructTypeExampleEvolvedSchema
+ records = DataSourceTestUtils.generateRandomRowsEvolvedSchema(5)
+ recordsSeq = convertRowListToSeq(records)
+
+ genRecRDD = HoodieSparkUtils.createRddWithLatestSchema(df1, schema,
evolSchema, "test_struct_name", "test_namespace")
+ val genRecs = genRecRDD.collect()
+ // if this succeeds w/o throwing any exception, test succeeded.
Review comment:
Can you add some more details for future folks as to what you are trying
to test here and why w/o exception is expected ?
--
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]