nsivabalan commented on code in PR #7951:
URL: https://github.com/apache/hudi/pull/7951#discussion_r1114880387
##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/HoodieSparkSqlWriter.scala:
##########
@@ -1018,6 +1023,26 @@ object HoodieSparkSqlWriter {
}
}
+ private def mayBeInferPartition(rawParams: Map[String, String]): Map[String,
String] = {
+ var optParams = rawParams
+ // if hoodie's partition path field is not set and incoming df's partition
is set, infer from it.
+ if
(!rawParams.containsKey(KeyGeneratorOptions.PARTITIONPATH_FIELD_NAME.key()) &&
optParams.containsKey(SPARK_DF_PARTITION_COLUMN_NAME)){
+ val partitionCols : String =
optParams.get(SPARK_DF_PARTITION_COLUMN_NAME).get
+ val partitionFieldValue : String = if (partitionCols.startsWith("[")) {
+ val parts : Array[String] = partitionCols.substring(1,
partitionCols.length-1).split(",")
+ var partitionFieldStr = ""
+ parts.foreach(part => {
+ partitionFieldStr += part.substring(1, part.length-1) + ","
+ })
+ partitionFieldStr.substring(0, partitionFieldStr.length - 1)
+ } else {
+ partitionCols
+ }
Review Comment:
lets jam on this. I am not sure if we can match an array of items. I know we
can match a group and we have to split it anyways. lets see if we can simplify
this or keep it how it is as of now.
--
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]