Write Drill query output to csv (or some other format)

后端 未结 5 1328
没有蜡笔的小新
没有蜡笔的小新 2020-12-17 23:27

I\'m using drill in embedded mode, and I can\'t figure out how to save query output other than copy and pasting it.

5条回答
  •  死守一世寂寞
    2020-12-17 23:40

    To set the output of a query in drill-embededd you need to create a table in the tmp schema first. Let's say you want to extract the first 5 rows of a parquet file input_file.parquet in your home folder and set the output to output_file.parquet

    CREATE TABLE dfs.tmp.`output_file.parquet`
    AS 
    (
     SELECT *
     FROM dfs.`/Users/your_user_name/input_file.parquet`
     LIMIT 5
    );
    

    File will be saved as /tmp/output_file.parquet.

    You can check the result inside drill with

    SELECT * 
    FROM dfs.tmp.`output_file.parquet`;
    

提交回复
热议问题