您的位置:首页 > 运维架构 > Apache

apache drill 的安装与调试

2014-01-17 11:12 363 查看
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;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  drill apache ubuntu maven 2