boneanxs commented on code in PR #9837:
URL: https://github.com/apache/hudi/pull/9837#discussion_r1351640998
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/HoodieSqlCommonUtils.scala:
##########
@@ -326,10 +326,18 @@ object HoodieSqlCommonUtils extends SparkAdapterSupport {
def getPartitionPathToDrop(
hoodieCatalogTable: HoodieCatalogTable,
normalizedSpecs: Seq[Map[String, String]]):
String = {
- val table = hoodieCatalogTable.table
- val allPartitionPaths = hoodieCatalogTable.getPartitionPaths
- val enableHiveStylePartitioning =
isHiveStyledPartitioning(allPartitionPaths, table)
- val enableEncodeUrl = isUrlEncodeEnabled(allPartitionPaths, table)
+ val (enableHiveStylePartitioning, enableEncodeUrl) = {
+ val tableConfig = hoodieCatalogTable.tableConfig
+ val enableHiveStylePartitioning =
Option(tableConfig.getHiveStylePartitioningEnable)
+ val enableEncodeUrl = Option(tableConfig.getUrlEncodePartitioning)
+ if (enableHiveStylePartitioning.isDefined && enableEncodeUrl.isDefined) {
+ (enableHiveStylePartitioning.get.toBoolean,
enableEncodeUrl.get.toBoolean)
+ } else {
+ val table = hoodieCatalogTable.table
+ val allPartitionPaths = hoodieCatalogTable.getPartitionPaths
+ (isHiveStyledPartitioning(allPartitionPaths, table),
isUrlEncodeEnabled(allPartitionPaths, table))
+ }
+ }
val partitionFields = hoodieCatalogTable.partitionFields
val partitionsToDrop = normalizedSpecs.map(
Review Comment:
Can refine codes by directly call `val partitionsToDrop =
normalizedSpecs.map(makePartitionPath(hoodieCatalogTable, _)`
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/HoodieSqlCommonUtils.scala:
##########
@@ -326,10 +326,18 @@ object HoodieSqlCommonUtils extends SparkAdapterSupport {
def getPartitionPathToDrop(
hoodieCatalogTable: HoodieCatalogTable,
normalizedSpecs: Seq[Map[String, String]]):
String = {
- val table = hoodieCatalogTable.table
- val allPartitionPaths = hoodieCatalogTable.getPartitionPaths
- val enableHiveStylePartitioning =
isHiveStyledPartitioning(allPartitionPaths, table)
- val enableEncodeUrl = isUrlEncodeEnabled(allPartitionPaths, table)
+ val (enableHiveStylePartitioning, enableEncodeUrl) = {
+ val tableConfig = hoodieCatalogTable.tableConfig
+ val enableHiveStylePartitioning =
Option(tableConfig.getHiveStylePartitioningEnable)
Review Comment:
`HiveStylePartitioning` and `urlEncoding` are required configures for
HoodieTableConfig, so we don't need to check it here?
--
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]