yihua commented on code in PR #10904:
URL: https://github.com/apache/hudi/pull/10904#discussion_r1538453838
##########
hudi-client/hudi-spark-client/src/main/scala/org/apache/hudi/AvroConversionUtils.scala:
##########
@@ -98,13 +98,10 @@ object AvroConversionUtils {
*/
def createDataFrame(rdd: RDD[GenericRecord], schemaStr: String, ss:
SparkSession): Dataset[Row] = {
ss.createDataFrame(rdd.mapPartitions { records =>
- if (records.isEmpty) Iterator.empty
- else {
- val schema = new Schema.Parser().parse(schemaStr)
- val dataType = convertAvroSchemaToStructType(schema)
- val converter = createConverterToRow(schema, dataType)
- records.map { r => converter(r) }
- }
+ val schema = new Schema.Parser().parse(schemaStr)
Review Comment:
Let's test all the relevant code path involving `records.isEmpty` with empty
Spark partitions on multiple Spark versions to make sure the removal of
`#isEmpty` is safe.
--
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]