Alexandros Mavrommatis created SPARK-36947:
----------------------------------------------
Summary: Exception when trying to access Row field using getAs
method
Key: SPARK-36947
URL: https://issues.apache.org/jira/browse/SPARK-36947
Project: Spark
Issue Type: Bug
Components: SQL
Affects Versions: 3.1.2
Environment: Spark 3.1.2 (but this also may affect other versions as
well)
Reporter: Alexandros Mavrommatis
I have an input dataframe *df* with the following schema:
{code:java}
|-- origin: string (nullable = true)
|-- product: struct (nullable = true)
| |-- id: integer (nullable = true){code}
when I try to select the first 20 rows of the id column I execute:
{code:java}
df.select("product.id").show(20, false)
{code}
**and I manage to get the result. But when I execute the following:
{code:java}
df.map(_.getAs[Int]("product.id")).show(20, false){code}
I get the following error:
{code:java}
java.lang.IllegalArgumentException: Field "product.id" does not exist.{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]