- Mastering Apache Spark 2.x(Second Edition)
- Romeo Kienzler
- 110字
- 2021-07-02 18:55:29
Using SQL
After using the previous Scala example to create a data frame from a JSON input file on HDFS, we can now define a temporary table based on the data frame and run SQL against it.
The following example shows you the temporary table called washing_flat being defined and a row count being created using count(*):

The schema for this data was created on the fly (inferred). This is a very nice function of the Apache Spark DataSource API that has been used when reading the JSON file from HDFS using the SparkSession object. However, if you want to specify the schema on your own, you can do so.
推薦閱讀
- C程序設計簡明教程(第二版)
- C#程序設計實訓指導書
- Arduino by Example
- Rake Task Management Essentials
- Nexus規模化Scrum框架
- PHP 8從入門到精通(視頻教學版)
- 深度實踐KVM:核心技術、管理運維、性能優化與項目實施
- Clojure High Performance Programming(Second Edition)
- 百萬在線:大型游戲服務端開發
- 從“1”開始3D編程
- Android開發權威指南(第二版)
- Spring Microservices
- Visual C++ 2017網絡編程實戰
- Java核心技術卷I基礎知識(原書第9版)
- Elasticsearch源碼解析與優化實戰