You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/05/18 04:53:11 UTC
[GitHub] [hudi] leesf commented on a diff in pull request #5588: [HUDI-4100] CTAS failed to clean up when given an illegal MANAGED table definition
leesf commented on code in PR #5588:
URL: https://github.com/apache/hudi/pull/5588#discussion_r875465444
##########
hudi-spark-datasource/hudi-spark3/src/main/scala/org/apache/spark/sql/hudi/catalog/HoodieCatalog.scala:
##########
@@ -206,29 +236,17 @@ class HoodieCatalog extends DelegatingCatalogExtension
val newPartitionColumns = partitionColumns
val newBucketSpec = maybeBucketSpec
- val isByPath = isPathIdentifier(ident)
-
- val location = if (isByPath) Option(ident.name()) else Option(allTableProperties.get("location"))
- val id = ident.asTableIdentifier
-
- val locUriOpt = location.map(CatalogUtils.stringToURI)
- val existingTableOpt = getExistingTableIfExists(id)
- val loc = locUriOpt
- .orElse(existingTableOpt.flatMap(_.storage.locationUri))
- .getOrElse(spark.sessionState.catalog.defaultTablePath(id))
val storage = DataSource.buildStorageFormatFromOptions(writeOptions.--(needFilterProps))
- .copy(locationUri = Option(loc))
- val tableType =
- if (location.isDefined) CatalogTableType.EXTERNAL else CatalogTableType.MANAGED
Review Comment:
can we call deduceTableLocationURIAndTableType in `createHoodieTable ` and HoodieStageTable instead of call it before `createHoodieTable` and HoodieStageTable?
##########
hudi-spark-datasource/hudi-spark3/src/main/scala/org/apache/spark/sql/hudi/catalog/HoodieCatalog.scala:
##########
@@ -206,29 +236,17 @@ class HoodieCatalog extends DelegatingCatalogExtension
val newPartitionColumns = partitionColumns
val newBucketSpec = maybeBucketSpec
- val isByPath = isPathIdentifier(ident)
-
- val location = if (isByPath) Option(ident.name()) else Option(allTableProperties.get("location"))
- val id = ident.asTableIdentifier
-
- val locUriOpt = location.map(CatalogUtils.stringToURI)
- val existingTableOpt = getExistingTableIfExists(id)
- val loc = locUriOpt
- .orElse(existingTableOpt.flatMap(_.storage.locationUri))
- .getOrElse(spark.sessionState.catalog.defaultTablePath(id))
val storage = DataSource.buildStorageFormatFromOptions(writeOptions.--(needFilterProps))
- .copy(locationUri = Option(loc))
- val tableType =
- if (location.isDefined) CatalogTableType.EXTERNAL else CatalogTableType.MANAGED
Review Comment:
can we call deduceTableLocationURIAndTableType in `createHoodieTable ` and HoodieStageTable instead of call it before `createHoodieTable` and HoodieStageTable?
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org