xushiyan commented on a change in pull request #5145:
URL: https://github.com/apache/hudi/pull/5145#discussion_r837543782
##########
File path:
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/CreateHoodieTableCommand.scala
##########
@@ -179,7 +174,9 @@ object CreateHoodieTableCommand {
val client =
HiveClientUtils.newClientForMetadata(sparkSession.sparkContext.conf,
sparkSession.sessionState.newHadoopConf())
// create hive table.
- client.createTable(tableWithDataSourceProps, ignoreIfExists)
+ if (!client.tableExists(table.identifier.database.get,
table.identifier.table)) {
+ client.createTable(tableWithDataSourceProps, ignoreIfExists)
+ }
Review comment:
in this case, the `ignoreIfExists` variable is useless; it should always
be like `client.createTable(tableWithDataSourceProps, true)` ? then we don't
need the if condition and we can remove `ignoreIfExists`
##########
File path:
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/command/CreateHoodieTableCommand.scala
##########
@@ -167,10 +166,6 @@ object CreateHoodieTableCommand {
if (!dbExists) {
throw new NoSuchDatabaseException(dbName)
}
- // check table exists
- if (sparkSession.sessionState.catalog.tableExists(table.identifier)) {
- throw new TableAlreadyExistsException(dbName, table.identifier.table)
- }
Review comment:
ok got it. thanks for the illustration.
--
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]