使用Spark执行良好的性能.我想知道使用sql查询SQLContext是否合适,或者如果通过DataFrame函数进行查询更好df.select().
任何的想法?:)
我试图通过DataFrames从嵌套的JSON中获取列名.架构如下:
root
|-- body: struct (nullable = true)
| |-- Sw1: string (nullable = true)
| |-- Sw2: string (nullable = true)
| |-- Sw3: string (nullable = true)
| |-- Sw420: string (nullable = true)
|-- headers: struct (nullable = true)
| |-- endDate: string (nullable = true)
| |-- file: string (nullable = true)
| |-- startDate: string (nullable = true)
Run Code Online (Sandbox Code Playgroud)
我可以使用df.columns()获取列名"body"和"header"但是当我尝试使用df.select("body")从正文中获取列名(例如:Sw1,Sw2,...) ).columns它总是给我身体专栏.
有什么建议吗?:)