Github user wangyum commented on a diff in the pull request: https://github.com/apache/spark/pull/22591#discussion_r221431453 --- Diff: sql/core/src/main/scala/org/apache/spark/sql/Dataset.scala --- @@ -2300,6 +2300,60 @@ class Dataset[T] private[sql]( } } + /** + * (Scala-specific) Returns a new Dataset with renamed columns. + * This is a no-op if schema doesn't contain any columns in map. + * + * {{{ + * ds.withColumnsRenamed( + * "exist_column1" -> "new_column1", + * "exist_column2" -> "new_column2" + * ) + * }}} + * + * @group untypedrel + * @since 3.0.0 + */ + @scala.annotation.varargs + def withColumnsRenamed(columnMap: (String, String), columnMaps: (String, String)*): DataFrame = { + withColumnsRenamed((columnMap +: columnMaps).toMap) + } + + /** + * (Scala-specific) Returns a new Dataset with renamed columns. + * This is a no-op if schema doesn't contain any columns in map. + * + * {{{ + * ds.withColumnsRenamed(Map( + * "exist_column1" -> "new_column1", + * "exist_column2" -> "new_column2" + * )) + * }}} + * + * @group untypedrel + * @since 3.0.0 + */ + def withColumnsRenamed(columnMap: Map[String, String]): DataFrame = { --- End diff -- These changes seem to be duplicated: https://github.com/apache/spark/pull/22428/files#diff-7a46f10c3cedbf013cf255564d9483cdR2316
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org