You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/08/03 01:50:50 UTC
[GitHub] [spark] gatorsmile commented on a change in pull request #27066: [SPARK-31317][SQL] Add withField method to Column
gatorsmile commented on a change in pull request #27066:
URL: https://github.com/apache/spark/pull/27066#discussion_r464156306
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/Column.scala
##########
@@ -871,6 +871,72 @@ class Column(val expr: Expression) extends Logging {
*/
def getItem(key: Any): Column = withExpr { UnresolvedExtractValue(expr, Literal(key)) }
+ // scalastyle:off line.size.limit
+ /**
+ * An expression that adds/replaces field in `StructType` by name.
+ *
+ * {{{
+ * val df = sql("SELECT named_struct('a', 1, 'b', 2) struct_col")
+ * df.select($"struct_col".withField("c", lit(3)))
Review comment:
Have any of you try to run these examples? The optimizer ConstantFolding rule will break these examples.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org