apache drill简单试用

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值