返回首页

gbase数据、南大通用产品文档:GBase8a

更新日期:2024年09月11日

GBA-01EX-0010
错误码
错误标识
错误信息
GBA-01EX-001
ER_EXPRESS_HASH_I
Hash index error:%s

GBase 8a MPP Cluster 产品手册
7 附录
文档版本953(2022-04-10)
南大通用数据技术股份有限公司
1713
错误码
错误标识
错误信息
0
NDEX
错误出现原因
hash index error
分析与建议
根据错误信息寻求技术支持

为便于理解以上概念,下表举例说明每种典型场景下查询和结果集,用例使用
的建表语句和数据为:
create table t (i1 int,
vc1 varchar(10) masked with (function='partial(2,"*****",0)'),
vc2 varchar(10) masked with (function='partial(2,"*****",0)'));
insert into t values (1, 'nblknabpa', 'pombkaia');
insert into t values (2, '.mapkna', '0jbadflk');
insert into t values ();

示例1:第i 类函数case when 脱敏列规则;
gbase>select case i1 when 1 then vc1 when 2 then '12345' else '67890' end as res
from t;
+---------+
| res |
+---------+
| nb***** |
| 12***** |
| 67***** |
+---------+

示例2:第i 类函数coalesce 脱敏列规则;
gbase>select coalesce(vc1,'12345') as res from t;
+---------+
| res |
+---------+
| nb***** |
| .m***** |
| 12***** |
+---------+

示例3:第i 类函数case when 多脱敏列默认脱敏;

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 292
gbase>
select case i1 when 1 then vc1 when 2 then vc2 else '67890' end as res from
t;
+------+
| res |
+------+
| xxxx |
| xxxx |
| xxxx |
+------+

示例4:第ii 类函数substring 默认脱敏;
gbase> select substring(vc1, 1, 2) as res from t;
+------+
| res |
+------+
| xx |
| xx |
| NULL |
+------+

示例5:第ii 类函数concat 默认脱敏;
gbase> select concat(vc1,'123') as res from t;
+------+
| res |
+------+
| xxxx |
| xxxx |
| NULL |
+------+

示例6:第i 类函数嵌套使用;
gbase> select case when i1 > 1 then coalesce(vc1, '12345') else '67890' end as res
from t;
+---------+
| res |
+---------+
| 67***** |
| .m***** |
| 67***** |
+---------+

示例7:第ii 类函数嵌套使用;

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 293
gbase> select concat(substring(vc1,1,2),'123') as res from t;
+------+
| res |
+------+
| xxxx |
| xxxx |
| NULL |
+------+

示例8:第 i 类和ii 类函数混合嵌套调用;
gbase> select coalesce(substring(vc1,1,2),'12345') as res from t;
(或者select substring(coalesce (vc1, '12345'), 1, 2) as res from t;)
+------+
| res |
+------+
| xxxx |
| xxxx |
| xxxx |
+------+

示例9:子查询内或外调用i 类;
gbase> select res from (select coalesce(vc1,'12345')as res from t) as tmp;
(或者select coalesce(vc1, '12345') as res from (select vc1 from t) as tmp;)
+---------+
| res |
+---------+
| nb***** |
| .m***** |
| 12***** |
+---------+

示例10:子查询内或外调用ii 类;
gbase> select res from (select concat(vc1,'123') as res from t) as tmp;
(或者select concat (vc1, '123') as res from (select vc1 from t) as tmp;)
+------+
| res |
+------+
| xxxx |
| xxxx |
| NULL |
+------+

示例11:子查询内外调用i 类;

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 294
gbase> select case when i1 > 1 then res1 else '67890' end as res from (select
i1,coalesce(vc1, '12345') as res1 from t) as tmp;
+---------+
| res |
+---------+
| 67***** |
| .m***** |
| 67***** |
+---------+

示例12:子查询内外调用ii 类;
gbase> select concat(res1,'123') as res from (select substring(vc1,1,2) as res1
from t) as tmp;
+------+
| res |
+------+
| xxxx |
| xxxx |
| NULL |
+------+

示例13:子查询内外混合调用i 类和ii 类。
gbase> select substring(res1,1,4) as res from (select coalesce(vc1, '12345') as
res1 from t) as tmp;
(或者
gbase> select coalesce(res1, '12345') as res from (select substring(vc1,1,2) a
s res1 from t) as tmp; )
+------+
| res |
+------+
| xxxx |
| xxxx |
| xxxx |
+------+

说明
脱敏列脱敏后如果超过脱敏列的最大长度,则自动截断为脱敏列的最大长度。
比如脱敏列定义为:
mask_col varchar(5) masked with (function ='partial(2,"xxxx",2)')
则值“abcde”理论上应脱敏为“abxxxxde”,脱敏后的长度超过了最大长度5,自动
截断为“abxxx”。

GBase UP 产品手册 5 数据库管理指南
文档版本04(2021-04-21) 南大通用数据技术股份有限公司 295
脱敏列脱敏后对于一些可设置长度的函数脱敏时也会被截断,比如:
select left(mask_col, 2) from t;
left 函数将使用默认脱敏,理论上应脱敏为“xxxx”,但超过了left 函数设置的最大
长度,所以自动截断为“xx”。
Union、Intersect 和Minus 运算时,对应列的脱敏规则与控制流函数的脱敏规则一致。

比如:
select mask_int_col from t union select mask_int_col as col from t;
将使用mask_int_col 的脱敏规则,而:
select mask_int_col from t union select mask_int_col+1 from t;
将使用默认脱敏。
系统表和视图
概述
GBase UP 中的系统表存在于四个database 中,分别是information_schema, gbase,
gclusterdb 及performance_schema。其中,information_schema 中的信息为元数据信
息,这些信息是通过组织相关对象获得的,不是预先存储的信息;gbase 库存放的
是一些持久化存储的信息,信息存储在gssys 引擎的表中;gclusterdb 存储的是需要
在集群范围保存的信息,
使用的是express 引擎;
performance_schema 存储的是运行
状态信息。

示例如下:
CREATE OR REPLACE PROCEDURE P_5_11 AS
TYPE triplet IS VARRAY(3) OF VARCHAR2(15);
TYPE trio IS VARRAY(3) OF VARCHAR2(15);
group1 triplet := triplet('Jones', 'Wong', 'Marceau');
group2 triplet;
group3 trio;
BEGIN
group2 := group1; -- succeeds
group3 := group1; -- fails
END;

--Result:
--ORA-06550: line 10, column 13:
--PLS-00382: expression is of wrong type

可变数组类型Triplet和trio具有相同的元素类型VARCHAR(15),集合变量group1和
group2具有相同的数据类型,但group3却不相同。可以把group1赋值给group2,不能把
group1赋值给group3.相同的数据类型是前提。
对于可变数组和嵌套表变量,可以指定NULL或者相同数据类型的NULL集合。两种方
式均可为变量赋值为NULL。