1 下载
curl -O https://mirrors.tuna.tsinghua.edu.cn/apache/drill/drill-1.17.0/apache-drill-1.17.0.tar.gz
tar zxvf apache-drill-1.17.0.tar.gz -C /opt/
mv /opt/apache-drill-1.17.0 /opt/drill
2 配置 conf/drill-env.sh
export WORK="/opt/"
export JAVA="$WORK/jdk1.8/bin/java"
export JAVA_HOME="$WORK/jdk1.8"#
3 启动
在/opt下建文本文件test.csv:
1101,SteveEurich,Steve,Eurich,16,StoreT
1102,MaryPierson,Mary,Pierson,16,StoreT
1103,LeoJones,Leo,Jones,16,StoreTem
1104,NancyBeatty,Nancy,Beatty,16,StoreT
1105,ClaraMcNight,Clara,McNight,16,Store
sqlline -u jdbc:drill:zk=local
apache drill> select * from dfs.`/opt/test.csv`;
apache drill> select columns[1],columns[0]+10 from dfs.`/opt/test.csv`;
4 使用hdfs
配置http://host:8047/storage
输入hello
{
"type": "file",
"connection": "hdfs://host-58:8020",
"config": null,
"workspaces": {
"hi": {
"location": "/",
"writable": true,
"defaultInputFormat": "json",
"allowAccessOutsideWorkspace": false
},
"tmp": {
"location": "/tmp",
"writable": true,
"defaultInputFormat": null,
"allowAccessOutsideWorkspace": false
},
"root": {
"location": "/",
"writable": false,
"defaultInputFormat": null,
"allowAccessOutsideWorkspace": false
}
},
"formats": {
"psv": {
"type": "text",
"extensions": [
"tbl"
],
"delimiter": "|"
},
"csv": {
"type": "text",
"extensions": [
"csv"
],
"delimiter": ","
},
"tsv": {
"type": "text",
"extensions": [
"tsv"
],
"delimiter": "\t"
},
"httpd": {
"type": "httpd",
"logFormat": "%h %t \"%r\" %>s %b \"%{Referer}i\"",
"timestampFormat": null
},
"parquet": {
"type": "parquet"
},
"json": {
"type": "json",
"extensions": [
"json"
]
},
"avro": {
"type": "avro"
},
"sequencefile": {
"type": "sequencefile",
"extensions": [
"seq"
]
},
"csvh": {
"type": "text",
"extensions": [
"csvh"
],
"extractHeader": true,
"delimiter": ","
}
},
"enabled": true
}
修改http://host:8047/options
store.json.read_numbers_as_double 改为true
启动 drill-embedded
apache drill> select distinct(columns[0]+1) from hello.hi.`/tmp/test2.csv` a limit 10;
+--------+
| EXPR$0 |
+--------+
| 1102 |
| 1103 |
| 1104 |
| 1105 |
| 1106 |
+--------+
5 rows selected (0.867 seconds)
退出 !quit