简体   繁体   中英

Pure SQL way to save query output in Spark-sql

Is there any way to save query result to file using pure SQL form? I understand that we can do it easily using java or scala api. But I am looking for pure SQL solution which can be executed via Spark-sql CLI directly.

Create table is the closest thing:

CREATE TABLE table
USING format                   -- some format
LOCATION '/path/to/location'
AS SELECT * FROM some_view     -- some query

It is not fully equivalent to simple save methods, as it uses metastore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM