[
https://issues.apache.org/jira/browse/HUDI-1842?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17392642#comment-17392642
]
ASF GitHub Bot commented on HUDI-1842:
--------------------------------------
pengzhiwei2018 commented on a change in pull request #3393:
URL: https://github.com/apache/hudi/pull/3393#discussion_r682235910
##########
File path:
hudi-spark-datasource/hudi-spark/src/main/scala/org/apache/spark/sql/hudi/analysis/HoodieAnalysis.scala
##########
@@ -268,7 +269,25 @@ case class HoodieResolveReferences(sparkSession:
SparkSession) extends Rule[Logi
} else {
l
}
-
+ // Fill schema for Create Table without specify schema info
+ case c @ CreateTable(tableDesc, _, _)
+ if isHoodieTable(tableDesc) =>
+ val tablePath = getTableLocation(c.tableDesc, sparkSession)
+ .getOrElse(s"Missing location defined in table
${c.tableDesc.identifier}")
+ val metaClient = HoodieTableMetaClient.builder()
+ .setBasePath(tablePath)
+ .setConf(sparkSession.sessionState.newHadoopConf())
+ .build()
+ val tableSchema =
HoodieSqlUtils.getTableSqlSchema(metaClient).map(HoodieSqlUtils.addMetaFields)
+ if (tableSchema.isDefined && tableDesc.schema.isEmpty) {
+ // Fill the schema with the schema from the table
+ c.copy(tableDesc.copy(schema = tableSchema.get))
+ } else if (tableSchema.isDefined && tableDesc.schema !=
tableSchema.get) {
Review comment:
well, In scala, we usually use "=" or "!=" test compile two object.
--
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]
> [SQL] Spark Sql Support For The Exists Hoodie Table
> ---------------------------------------------------
>
> Key: HUDI-1842
> URL: https://issues.apache.org/jira/browse/HUDI-1842
> Project: Apache Hudi
> Issue Type: Sub-task
> Reporter: pengzhiwei
> Assignee: pengzhiwei
> Priority: Blocker
> Labels: pull-request-available, release-blocker
> Fix For: 0.9.0
>
>
> In order to support spark sql for hoodie, we persist some table properties to
> the hoodie.properties. e.g. primaryKey, preCombineField, partition columns.
> For the exists hoodie tables, these properties are missing. We need do some
> code in UpgradeDowngrade to support spark sql for the exists tables.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)