You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2025/01/22 22:46:46 UTC
(spark) branch branch-4.0 updated: [MINOR][SQL] Avoid importing java.util at DataFrameWriter
This is an automated email from the ASF dual-hosted git repository.
gurwls223 pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 00d0b7d4fba6 [MINOR][SQL] Avoid importing java.util at DataFrameWriter
00d0b7d4fba6 is described below
commit 00d0b7d4fba6ee3286712df4f5b6d779f4ab6ef2
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Thu Jan 23 07:46:28 2025 +0900
[MINOR][SQL] Avoid importing java.util at DataFrameWriter
### What changes were proposed in this pull request?
This PR avoids importing java.util at DataFrameWriter.
### Why are the changes needed?
Using `util` in the codebase is confusing and confusing if it requires Spark utils or other utils.
### Does this PR introduce _any_ user-facing change?
No, dev-only.
### How was this patch tested?
Existing tests.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #49602 from HyukjinKwon/minor-cleanup1.
Authored-by: Hyukjin Kwon <gu...@apache.org>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
(cherry picked from commit 44a334f520a0e3f3ea1b7d60084a1cfdc82bd2ad)
Signed-off-by: Hyukjin Kwon <gu...@apache.org>
---
.../src/main/scala/org/apache/spark/sql/DataFrameWriter.scala | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sql/api/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala b/sql/api/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
index 1838c6bc8468..be239eafbceb 100644
--- a/sql/api/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
+++ b/sql/api/src/main/scala/org/apache/spark/sql/DataFrameWriter.scala
@@ -16,7 +16,7 @@
*/
package org.apache.spark.sql
-import java.util
+import java.util.{Locale, Map, Properties}
import scala.jdk.CollectionConverters._
@@ -56,7 +56,7 @@ abstract class DataFrameWriter[T] {
* @since 1.4.0
*/
def mode(saveMode: String): this.type = {
- saveMode.toLowerCase(util.Locale.ROOT) match {
+ saveMode.toLowerCase(Locale.ROOT) match {
case "overwrite" => mode(SaveMode.Overwrite)
case "append" => mode(SaveMode.Append)
case "ignore" => mode(SaveMode.Ignore)
@@ -139,7 +139,7 @@ abstract class DataFrameWriter[T] {
*
* @since 1.4.0
*/
- def options(options: util.Map[String, String]): this.type = {
+ def options(options: Map[String, String]): this.type = {
this.options(options.asScala)
this
}
@@ -323,7 +323,7 @@ abstract class DataFrameWriter[T] {
* "READ_UNCOMMITTED".
* @since 1.4.0
*/
- def jdbc(url: String, table: String, connectionProperties: util.Properties): Unit = {
+ def jdbc(url: String, table: String, connectionProperties: Properties): Unit = {
assertNotPartitioned("jdbc")
assertNotBucketed("jdbc")
assertNotClustered("jdbc")
@@ -503,7 +503,8 @@ abstract class DataFrameWriter[T] {
protected var mode: SaveMode = SaveMode.ErrorIfExists
- protected var extraOptions: CaseInsensitiveMap[String] = CaseInsensitiveMap[String](Map.empty)
+ protected var extraOptions: CaseInsensitiveMap[String] =
+ CaseInsensitiveMap[String](scala.collection.immutable.Map.empty)
protected var partitioningColumns: Option[Seq[String]] = None
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org