xiarixiaoyao commented on code in PR #8026:
URL: https://github.com/apache/hudi/pull/8026#discussion_r1115543547
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieBaseRelation.scala:
##########
@@ -613,8 +617,11 @@ object HoodieBaseRelation extends SparkAdapterSupport {
def apply(file: PartitionedFile): Iterator[InternalRow] = read.apply(file)
}
- def convertToAvroSchema(structSchema: StructType): Schema =
- sparkAdapter.getAvroSchemaConverters.toAvroType(structSchema, nullable =
false, "Record")
+ def convertToAvroSchema(structSchema: StructType, tableName: String ):
Schema = {
+ val (recordName, namespace) =
AvroConversionUtils.getAvroRecordNameAndNamespace(tableName)
+ val avroSchema =
sparkAdapter.getAvroSchemaConverters.toAvroType(structSchema, nullable = false,
recordName, namespace)
+ getAvroSchemaWithDefaults(avroSchema, structSchema)
+ }
Review Comment:
@qidian99 keep default value for avro schema,
as we need do schema evolution. this modify also fix the bug
https://github.com/apache/hudi/pull/7915
--
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]