天天看点

Apache Drill关联查询

1.配置数据源

可查考: Apache Drill 常用Plugins配置

2.同库关联查询

a).创建HBase表

create 'hbase_entry_index','cf1'

create 'hbase_entry_second','cf1'           
Apache Drill关联查询

b).插入数据

put 'hbase_entry_index', 'rowid_11', 'cf1:value', '13456789'
put 'hbase_entry_index', 'rowid_12', 'cf1:value', '56432234567'

put 'hbase_entry_second', 'rowid_11', 'cf1:value', '65432345678'
put 'hbase_entry_second', 'rowid_19', 'cf1:value', '867543224565675'           
Apache Drill关联查询

c).查询数据

## 进入sqlline后台查询界面
./drill/bin/sqlline -u jdbc:drill:zk=hostname:2181

## 查数据库
show databases;

## 切换数据库
use hbase

## 查询表
!table

## 关联查询数据
select * from hbase_entry_index t1,hbase_entry_second t2 where t1.row_key=t2.row_key           

查数据库

Apache Drill关联查询

切换数据库

Apache Drill关联查询

查询表

Apache Drill关联查询

关联查询数据

Apache Drill关联查询

注意

貌似只支持row_key的关联
Apache Drill关联查询

3.跨库关联查询

配置数据源

Apache Drill关联查询
Apache Drill关联查询

select * from mysql22.mysql.user t1,mysql66.mysql.user t2 where t1.user=t2.user;           
Apache Drill关联查询