yihua commented on code in PR #17573:
URL: https://github.com/apache/hudi/pull/17573#discussion_r2628693995
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestHoodieSparkSqlWriterWithTestFormat.scala:
##########
@@ -268,8 +268,8 @@ class TestHoodieSparkSqlWriterWithTestFormat extends
HoodieSparkWriterTestBase {
.updated(HoodieTableConfig.TABLE_FORMAT.key, "test-format")
// generate the inserts
- val schema = DataSourceTestUtils.getStructTypeExampleSchema
- val structType = AvroConversionUtils.convertAvroSchemaToStructType(schema)
+ val schema = DataSourceTestUtils.getStructTypeExampleHoodieSchema
Review Comment:
Could we change `DataSourceTestUtils#getStructTypeExampleSchema` directly
instead of adding a new one `getStructTypeExampleHoodieSchema`?
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestTableSchemaResolverWithSparkSQL.scala:
##########
@@ -122,10 +122,11 @@ class TestTableSchemaResolverWithSparkSQL extends
HoodieSparkWriterTestBase {
metaClient.reloadActiveTimeline()
var tableSchemaResolverParsingException: Exception = null
try {
- val schemaFromData = new
TableSchemaResolver(metaClient).getTableAvroSchemaFromDataFile
- val structFromData =
AvroConversionUtils.convertAvroSchemaToStructType(HoodieAvroUtils.removeMetadataFields(schemaFromData))
- val schemeDesign = new Schema.Parser().parse(schemaString)
- val structDesign =
AvroConversionUtils.convertAvroSchemaToStructType(schemeDesign)
+ val schemaFromData = HoodieSchema.fromAvroSchema(
+ new TableSchemaResolver(metaClient).getTableAvroSchemaFromDataFile)
Review Comment:
Should `TableSchemaResolver` provide a new API `getTableSchemaFromDataFile`
that returns `HoodieSchema`
##########
hudi-spark-datasource/hudi-spark/src/test/scala/org/apache/hudi/TestTableSchemaResolverWithSparkSQL.scala:
##########
@@ -122,10 +122,11 @@ class TestTableSchemaResolverWithSparkSQL extends
HoodieSparkWriterTestBase {
metaClient.reloadActiveTimeline()
var tableSchemaResolverParsingException: Exception = null
try {
- val schemaFromData = new
TableSchemaResolver(metaClient).getTableAvroSchemaFromDataFile
- val structFromData =
AvroConversionUtils.convertAvroSchemaToStructType(HoodieAvroUtils.removeMetadataFields(schemaFromData))
- val schemeDesign = new Schema.Parser().parse(schemaString)
- val structDesign =
AvroConversionUtils.convertAvroSchemaToStructType(schemeDesign)
+ val schemaFromData = HoodieSchema.fromAvroSchema(
+ new TableSchemaResolver(metaClient).getTableAvroSchemaFromDataFile)
+ val structFromData =
HoodieSchemaConversionUtils.convertHoodieSchemaToStructType(org.apache.hudi.common.schema.HoodieSchemaUtils.removeMetadataFields(schemaFromData))
Review Comment:
nit: import `org.apache.hudi.common.schema.HoodieSchemaUtils`
--
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]