Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,17 @@ class HoodieCatalogTable(val spark: SparkSession, var table: CatalogTable) exten
/**
* Table schema
*/
lazy val tableSchema: StructType = table.schema
lazy val tableSchema: StructType = if (table.schema.nonEmpty) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to call loadTableSchemaByMetaClient directly without having to decide if table.schema is empty.
Parsing the metadata on spark does not need to depend on the meta from metastore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@YannByron The table.schema is not obtained from the hive metastore, but is specified by the user. Only when the user does not specify a schema, we can parse and obtain the schema from the file through the method loadTableSchemaByMetaClient

table.schema
} else {
val schemaFromMetaOpt = loadTableSchemaByMetaClient()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this already handled in parseSchemaAndConfigs() , isn't it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jinxing64 can you also have a look pls? given this is based on your previous change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this already handled in parseSchemaAndConfigs() , isn't it?
yes

if (schemaFromMetaOpt.nonEmpty) {
schemaFromMetaOpt.get
} else {
throw new AnalysisException(
s"Missing schema fields when applying CREATE TABLE clause for $catalogTableName")
}
}

/**
* The schema without hoodie meta fields
Expand Down