[ https://issues.apache.org/jira/browse/SPARK-35309?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Derk Crezee resolved SPARK-35309. --------------------------------- Resolution: Not A Bug > array transform should respect alias in expression > -------------------------------------------------- > > Key: SPARK-35309 > URL: https://issues.apache.org/jira/browse/SPARK-35309 > Project: Spark > Issue Type: Bug > Components: SQL > Affects Versions: 3.1.0 > Reporter: Derk Crezee > Priority: Major > > When an array is transformed using the transform function in combination with > an alias, I get an unexpected column name. > {code:scala} > // code placeholder > val data = Seq((Array(1, 2, 3))) > val df = sc.parallelize(data).toDF("a") > val dfRes = df.select( > transform( > $"a", > (col: Column) => struct(col).alias("struct_alias") > ).alias("a") > ) > dfRes.printSchema > // root > // |-- a: array (nullable = true) > // | |-- element: struct (containsNull = false) > // | | |-- x: integer (nullable = false) > {code} > I expected the inner element to have the name 'struct_alias'. -- This message was sent by Atlassian Jira (v8.3.4#803005) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org