1
0

[HUDI-3171] Sync empty table to hive metastore (#4511)

This commit is contained in:
Danny Chan
2022-01-05 16:41:33 +08:00
committed by GitHub
parent a66212d204
commit 0e297c0c4c
2 changed files with 19 additions and 9 deletions

View File

@@ -198,8 +198,15 @@ public class TableSchemaResolver {
*/
public MessageType getTableParquetSchema() throws Exception {
Option<Schema> schemaFromCommitMetadata = getTableSchemaFromCommitMetadata(true);
return schemaFromCommitMetadata.isPresent() ? convertAvroSchemaToParquet(schemaFromCommitMetadata.get()) :
getTableParquetSchemaFromDataFile();
if (schemaFromCommitMetadata.isPresent()) {
return convertAvroSchemaToParquet(schemaFromCommitMetadata.get());
}
Option<Schema> schemaFromTableConfig = metaClient.getTableConfig().getTableCreateSchema();
if (schemaFromTableConfig.isPresent()) {
Schema schema = HoodieAvroUtils.addMetadataFields(schemaFromTableConfig.get(), withOperationField);
return convertAvroSchemaToParquet(schema);
}
return getTableParquetSchemaFromDataFile();
}
/**