阅读本文后: http://tgrall.github.io/blog/2015/08/17/convert-csv-file-to-apache-parquet-dot-dot-dot-with-drill/
我正在尝试将CSV文件转换为Parquet文件。我可以成功查询我的CSV:
select * from dfs.`/Users/[username]/Desktop/drill_example.csv` limit 5;
输出:
+-------------------+
| columns |
+-------------------+
| ["1","UT","M\r"] |
| ["2","CA","M\r"] |
| ["3","CA","F\r"] |
| ["4","NJ","M\r"] |
| ["5","FL","F\r"] |
+-------------------+
然后我通过以下方式将格式更改为Parquet:
alter session set `store.format`='parquet';
输出:
+-------+------------------------+
| ok | summary |
+-------+------------------------+
| true | store.format updated. |
+-------+------------------------+
然后我使用以下代码创建新表/文件:
CREATE TABLE dfs.tmp.`/Users/[username]/Desktop/drill_example_parquet` AS
select * from dfs.`/Users/[username]/Desktop/drill_example.csv`;
使用以下输出:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
+-----------+----------------------------+
| Fragment | Number of records written |
+-----------+----------------------------+
| 0_0 | 10000 |
+-----------+----------------------------+
1 row selected (1.292 seconds)
创建表/文件是因为我可以使用以下代码查询它:
SELECT *
FROM dfs.tmp.`/Users/[username]/Desktop/drill_example_parquet`;
但我无法在计算机上找到该文件。如何获取Parquet 文件(不是表格)?换句话说,我桌面上的CSV文件的Parquet版本。我必须以某种方式出口吗?另外,我完成后如何删除这些表格?
提前致谢。
答案 0 :(得分:1)
通过网络托管(dfs
)
xx.xx.xx.xx:8047/storage/dfs
插件
默认情况下temp
目录:
"tmp": {
"location": "/tmp",
"writable": true,
"defaultInputFormat": null
}
您的文件将位于(假设您没有链接tmp
目录):
的/ tmp /用户/ [用户名] /桌面/ drill_example_parquet