[GitHub] [hudi] wecharyu commented on a diff in pull request #9485: [HUDI-6730] Enable hoodie configuration using the --conf option with the "spark." prefix

2023-09-12 Thread via GitHub


wecharyu commented on code in PR #9485:
URL: https://github.com/apache/hudi/pull/9485#discussion_r1322743150


##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/HoodieSqlCommonUtils.scala:
##
@@ -223,6 +223,18 @@ object HoodieSqlCommonUtils extends SparkAdapterSupport {
   def isHoodieConfigKey(key: String): Boolean =
 key.startsWith("hoodie.") || key == 
DataSourceReadOptions.TIME_TRAVEL_AS_OF_INSTANT.key
 
+  /**
+   * Extract hoodie config from conf using prefix "spark.hoodie." and 
"hoodie.".
+   * Priority for the same key: hoodie. > spark.hoodie.
+   */
+  def extractHoodieConfig(conf: Map[String, String]): Map[String, String] = {
+val (withSparkPrefix, withoutSparkPrefix) = 
conf.partition(_._1.startsWith("spark."))
+val combinedConf = withSparkPrefix.map {
+  case (key, value) => (key.stripPrefix("spark."), value)

Review Comment:
   As I noticed the case insensitive check is more likely to be used in 
identifier compare like database name, table name etc. So I think it's OK to 
use original config 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: commits-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [hudi] wecharyu commented on a diff in pull request #9485: [HUDI-6730] Enable hoodie configuration using the --conf option with the "spark." prefix

2023-08-22 Thread via GitHub


wecharyu commented on code in PR #9485:
URL: https://github.com/apache/hudi/pull/9485#discussion_r1301286432


##
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/spark/sql/hudi/HoodieSqlCommonUtils.scala:
##
@@ -223,6 +223,17 @@ object HoodieSqlCommonUtils extends SparkAdapterSupport {
   def isHoodieConfigKey(key: String): Boolean =
 key.startsWith("hoodie.") || key == 
DataSourceReadOptions.TIME_TRAVEL_AS_OF_INSTANT.key
 
+  /**
+   * Extract hoodie config from conf using prefix "spark.hoodie." and 
"hoodie.".
+   */
+  def extractHoodieConfig(conf: Map[String, String]): Map[String, String] = {

Review Comment:
   Nice catch, it should be.



-- 
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-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org