This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new b45e3c01217a [MINOR] Use putAll to populate Properties
b45e3c01217a is described below

commit b45e3c01217af503735a735dabfc21c9b1e95126
Author: Zhihong Yu <[email protected]>
AuthorDate: Mon Dec 2 08:36:54 2024 +0900

    [MINOR] Use putAll to populate Properties
    
    ### What changes were proposed in this pull request?
    This PR uses the `putAll` method of `Properties` class in place of `put`.
    
    ### Why are the changes needed?
    In Scala 2.13, https://github.com/scala/bug/issues/10418 has been fixed.
    So we can avoid the workaround.
    
    ### Does this PR introduce _any_ user-facing change?
    No
    
    ### How was this patch tested?
    There is no change in functionality.
    Existing tests suffice.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    No
    
    Closes #48993 from tedyu/put-all.
    
    Authored-by: Zhihong Yu <[email protected]>
    Signed-off-by: Hyukjin Kwon <[email protected]>
---
 .../test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala | 4 +---
 .../spark/sql/hive/execution/HiveScriptTransformationExec.scala   | 8 ++------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git 
a/connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala
 
b/connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala
index 9e06b6c6ff4a..60de3705636e 100644
--- 
a/connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala
+++ 
b/connector/kafka-0-10-sql/src/test/scala/org/apache/spark/sql/kafka010/KafkaTestUtils.scala
@@ -504,9 +504,7 @@ class KafkaTestUtils(
       props.put("sasl.enabled.mechanisms", "GSSAPI,SCRAM-SHA-512")
     }
 
-    // Can not use properties.putAll(propsMap.asJava) in scala-2.12
-    // See https://github.com/scala/bug/issues/10418
-    withBrokerProps.foreach { case (k, v) => props.put(k, v) }
+    props.putAll(withBrokerProps.asJava)
     props
   }
 
diff --git 
a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala
 
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala
index 0fcc43e5c391..de2d15415837 100644
--- 
a/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala
+++ 
b/sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/HiveScriptTransformationExec.scala
@@ -283,9 +283,7 @@ object HiveScriptIOSchema extends HiveInspectors {
     propsMap = propsMap + (serdeConstants.LIST_COLUMN_TYPES -> 
columnTypesNames)
 
     val properties = new Properties()
-    // Can not use properties.putAll(propsMap.asJava) in scala-2.12
-    // See https://github.com/scala/bug/issues/10418
-    propsMap.foreach { case (k, v) => properties.put(k, v) }
+    properties.putAll(propsMap.asJava)
     serde.initialize(null, properties)
 
     serde
@@ -299,9 +297,7 @@ object HiveScriptIOSchema extends HiveInspectors {
       val instance = Utils.classForName[RecordReader](klass).getConstructor().
         newInstance()
       val props = new Properties()
-      // Can not use props.putAll(outputSerdeProps.toMap.asJava) in scala-2.12
-      // See https://github.com/scala/bug/issues/10418
-      ioschema.outputSerdeProps.toMap.foreach { case (k, v) => props.put(k, v) 
}
+      props.putAll(ioschema.outputSerdeProps.toMap.asJava)
       instance.initialize(inputStream, conf, props)
       instance
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to