外表使用
openGauss通过CREATE FOREIGN TABLE指定创建表使用的分区信息。CREATE FOREIGN TABLE的详细信息请参见。
- 遵循openGauss建立分区表的原则,PARTITION中的分区列必须为COLUMN包中的定义列,这一点与HIVE建表语法不同。
在openGauss中HDFS外表定义分区数和HIVE建表定义分区语法均对分区列的数目无限制,但是最多只支持对前四层分区进行剪枝。如果表分区列多于四个,openGauss将不会对其余分区列进行剪枝操作。
分区剪枝支持的操作包括大于、小于、不大于、不小于、等于、不等于、IS NULL、IS NOT NULL、ANY、ALL操作。对于二元表达式操作,操作符一边必须是基本列类型,另一边必须是const类型。
-
HINT: Please use 'DISTRIBUTE BY' clause to specify suitable data distribution column.
CREATE TABLE
DROP FOREIGN TABLE
NOTICE: CREATE FOREIGN TABLE / UNIQUE will create constraint "part_11constr_unique" for foreign table "region010"
CREATE FOREIGN TABLE
----+------------------------------------------------+--------+---------+---------
1 | -> Row Adapter | 43 | 76 | 68.71
3 | -> Vector Hash Join (4,5) | 43 | 76 | 66.03
4 | -> Vector Foreign Scan on region010 | 853 | 68 | 52.65
5 | -> Vector Streaming(type: BROADCAST) | 10 | 8 | 10.63
6 | -> CStore Scan on inner_tbl | 10 | 8 | 10.01
(6 rows)
Predicate Information (identified by plan id)
Hash Cond: (region010.r_regionkey = inner_tbl.a)
Generate Bloom Filter On Expr: inner_tbl.a
Generate Bloom Filter On Index: 0
4 --Vector Foreign Scan on region010
Server Type: hdfs
Filter By Bloom Filter On Expr: region010.r_regionkey
Filter By Bloom Filter On Index: 0
(8 rows)
目前存在一些表达式、函数等不支持下推,由于不能下推导致产生多表连接的查询无法再次转化为plan,最终将导致查询无法执行,需要改写SQL重新执行。例如出现如下错误:This SQL can not be executed because it can not be pushed down to datanode,则需要修改SQL语句重新执行。