XuQianJin-Stars commented on code in PR #5272:
URL: https://github.com/apache/hudi/pull/5272#discussion_r848975952
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/HoodieSqlCommonUtils.scala:
##########
@@ -372,4 +376,32 @@ object HoodieSqlCommonUtils extends SparkAdapterSupport {
}.mkString(",")
partitionsToDrop
}
+
+ def getPartitionPathToTruncate(hoodieCatalogTable: HoodieCatalogTable,
+ table: CatalogTable,
+ partitionSpec: Option[TablePartitionSpec],
+ resolver: Resolver): String = {
+ val partCols = table.partitionColumnNames
+ val normalizedSpec: Seq[Map[String, String]] = Seq(partitionSpec.map {
spec =>
+ normalizePartitionSpec(
+ spec,
+ partCols,
+ table.identifier.quotedString,
+ resolver)
+ }.get)
+
+ val allPartitionPaths = hoodieCatalogTable.getPartitionPaths
+ val enableEncodeUrl = isUrlEncodeEnabled(allPartitionPaths, table)
+
+ val partitionsToTruncate = normalizedSpec.map { spec =>
+ hoodieCatalogTable.partitionFields.map { partitionColumn =>
+ if (enableEncodeUrl) {
+ partitionColumn + "=" + "\"" + spec(partitionColumn) + "\""
Review Comment:
> this encode case did not call `PartitionPathEncodeUtils.escapePathName`?
The urlcode character appears in the partition, which cannot be deleted with
single quotation marks. Double quotation marks are used after url decoding.
--
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]