【问题现象】建表时出现报错:error: there is no hash distributable column/column %s is not a hash distributable data type
【问题原因】创建hash表时没有可用的分布列
目前,支持做分布列的类型有:int1,int2,int4,int8,numeric,char,varchar,bpchar,nvarchar2,date,timestamp,uuid,interval,text等。
因此,当创建的表中没有可用的分布键或指定的分布键列类型不支持时就会出现相关报错:
test_db=# create table t(a float);
error: there is no hash distributable column
test_db=#
test_db=# create table t(a float, b int) distribute by hash(a);
error: column a is not a hash distributable data type
test_db=#
【解决方法】增加一个可以用作分布列类型的字段,或修改现有类型:
test_db=# create table t(a float, b int);
notice: the 'distribute by' clause is not specified. using 'b' as the distribution column by default.
hint: please use 'distribute by' clause to specify suitable data distribution column.
create table
test_db=#
test_db=# create table t2(a float, b int) distribute by hash(b);
create table
test_db=#
test_db=#
test_db=# create table t3(a numeric);
notice: the 'distribute by' clause is not specified. using 'a' as the distribution column by default.
hint: please use 'distribute by' clause to specify suitable data distribution column.
create table
test_db=#
感谢精彩分享
-- 高级云网管
感谢分享
感谢分享