My Dataset ds
has the following schema:
root
|-- id: string (nullable = true)
|-- type: string (nullable = true)
|-- item: struct (nullable = true)
| |-- item: string (nullable = true)
Sample:
{"id":"1","type": "aaa", "item": {"item":"11"}}
{"id":"2","type": "bbb", "item" : {"item":"12"}}
How can I retrieve item
from struct to get this result?
id type item
1 aaa 11
2 bbb 12
This is what I tried without success:
ds.select("id", "type", "item.0");
Please notice that I use Java. Do not post answers in Scala or Python unless they are identical for Java.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…