apache drill 的安装与调试

             Apche drill安装与调试 (ubuntu 12.4系统)

一、安装
1、Maven 
You will need maven 2 or higher

apt-get install maven

2、Java 1.7
You will need java 1.7 to compile and run the Drill demo.

apt-get install openjdk-7-jdk
sudo update-alternatives --set java $(update-alternatives --list java | grep 7 | head -1)

3、Protobuf
Drill requires Protobuf 2.5. 

wget http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.bz2  
tar xfj protobuf-2.5.0.tar.bz2 
pushd protobuf-2.5.0 
./configure 
make 
sudo make install
安装后执行protoc –version报错:protoc: error while loading shared libraries: libprotoc.so.8: cannot open shared object file: No such file or directory 
解决方法: 
1>添加环境变量: 
vi ~/.bashrc文件,将/usr/local/lib设置到 PATH变量中。 
export PATH="$PATH:/usr/local/lib: " 
2>添加so库路径:
(1). 创建文件 /etc/ld.so.conf.d/libprotobuf.conf 包含内容: /usr/local/lib

(2). 输入命令
sudo ldconfig 

4、git
apt-get install git-all

5、apache drill
(1)Get the Source
git clone https://git-wip-us.apache.org/repos/asf/incubator-drill.git


(2)Compile the Code

cd incubator-drill
mvn clean install -DskipTests
rm .classpath



(3)Run the interactive Drill shell

./sqlline -u jdbc:drill:schema=parquet-local -n admin -p admin



(4)Run a Query
select * from "sample-data/region.parquet";


drill输出文件sample-data/region.parquet中的内容,drill正常运行

二、调试

1、支持join查询

SELECT nations.name, regions.name FROM (
  SELECT _MAP['N_REGIONKEY'] as regionKey, _MAP['N_NAME'] as name 
  FROM "sample-data/nation.parquet") nations
join (
  SELECT _MAP['R_REGIONKEY'] as regionKey, _MAP['R_NAME'] as name 
  FROM "sample-data/region.parquet") regions 
  on nations.regionKey = regions.regionKey
  order by nations.name;

2、count distinct

SELECT count(distinct _MAP['N_REGIONKEY']) FROM "sample-data/nation.parquet";


3、order by

SELECT
_MAP['N_REGIONKEY'] as regionKey,
_MAP['N_NAME'] as name 
FROM
"sample-data/nation.parquet"
ORDER BY 
_MAP['N_NAME'] DESC;


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值