jinxing64 commented on code in PR #5588:
URL: https://github.com/apache/hudi/pull/5588#discussion_r875507389
##########
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:
You mean -- HoodieStageTable invokes `deduceTableLocationURIAndTableType` to
get the "path" and then invokes `createHoodieTable`. While inside
`createHoodieTable` invokes `deduceTableLocationURIAndTableType` AGAIN to get
the "path";
I'd prefer to invoke `deduceTableLocationURIAndTableType` only once between
HoodieCatalog and HoodieStageTable. The deducing logic doesn't make much
performance cost. But I'd rather keep the invoking logic straightforward.
--
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]