Github user MaxGekk commented on a diff in the pull request: https://github.com/apache/spark/pull/21840#discussion_r204250170 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/collectionOperations.scala --- @@ -3858,3 +3858,29 @@ object ArrayUnion { new GenericArrayData(arrayBuffer) } } + +case class StructCopy( + struct: Expression, + fieldName: String, + fieldValue: Expression) extends Expression with CodegenFallback { + + override def children: Seq[Expression] = Seq(struct, fieldValue) + override def nullable: Boolean = struct.nullable + + lazy val fieldIndex = struct.dataType.asInstanceOf[StructType].fieldIndex(fieldName) --- End diff -- I think it makes sense to add new field if it doesn't exist. Similar to withColumn which updates an existing column or adds new one if the column name doesn't exist
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org