You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Derk Crezee (Jira)" <ji...@apache.org> on 2021/05/04 09:47:00 UTC
[jira] [Created] (SPARK-35309) array transform should respect alias
in expression
Derk Crezee created SPARK-35309:
-----------------------------------
Summary: 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
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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org