[fix](array-type) array can not be distributed key and aggregation key (#12082)
Array column should not be distributed key or group by or aggregate key, we should forbid it before create table. Co-authored-by: cambyzju <zhuxiaoli01@baidu.com>
This commit is contained in:
@ -75,14 +75,6 @@ public class HashDistributionDesc extends DistributionDesc {
|
||||
if (!distColSet.add(columnName)) {
|
||||
throw new AnalysisException("Duplicated distribution column " + columnName);
|
||||
}
|
||||
for (ColumnDef columnDef : columnDefs) {
|
||||
if (columnDef.getName().equals(columnName)) {
|
||||
if (columnDef.getType().isScalarType(PrimitiveType.STRING)) {
|
||||
throw new AnalysisException("String Type should not be used in distribution column["
|
||||
+ columnDef.getName() + "].");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,8 +113,15 @@ public class HashDistributionDesc extends DistributionDesc {
|
||||
throw new DdlException("Distribution column[" + colName + "] is not key column");
|
||||
}
|
||||
|
||||
if (column.getType().isFloatingPointType()) {
|
||||
throw new DdlException("Floating point type column can not be distribution column");
|
||||
if (column.getType().isScalarType(PrimitiveType.STRING)) {
|
||||
throw new DdlException("String Type should not be used in distribution column["
|
||||
+ column.getName() + "].");
|
||||
} else if (column.getType().isArrayType()) {
|
||||
throw new DdlException("Array Type should not be used in distribution column["
|
||||
+ column.getName() + "].");
|
||||
} else if (column.getType().isFloatingPointType()) {
|
||||
throw new DdlException("Floating point type should not be used in distribution column["
|
||||
+ column.getName() + "].");
|
||||
}
|
||||
|
||||
distributionColumns.add(column);
|
||||
|
||||
@ -270,14 +270,12 @@ public abstract class Type {
|
||||
// 3. don't support group by
|
||||
// 4. don't support index
|
||||
public boolean isOnlyMetricType() {
|
||||
// now only_metric_type is the same to object_stored_type
|
||||
// but actually they are not same in semantics.
|
||||
return isObjectStored();
|
||||
return isObjectStored() || isArrayType();
|
||||
}
|
||||
|
||||
public static final String OnlyMetricTypeErrorMsg =
|
||||
"Doris hll and bitmap column must use with specific function, and don't support filter or group by."
|
||||
+ "please run 'help hll' or 'help bitmap' in your mysql client.";
|
||||
"Doris hll, bitmap and array column must use with specific function, and don't support filter or group by."
|
||||
+ "please run 'help hll' or 'help bitmap' or 'help array' in your mysql client.";
|
||||
|
||||
public boolean isHllType() {
|
||||
return isScalarType(PrimitiveType.HLL);
|
||||
|
||||
@ -230,7 +230,7 @@ public class CreateTableTest {
|
||||
@Test
|
||||
public void testAbnormal() throws DdlException {
|
||||
ExceptionChecker.expectThrowsWithMsg(DdlException.class,
|
||||
"Floating point type column can not be distribution column",
|
||||
"Floating point type should not be used in distribution column",
|
||||
() -> createTable("create table test.atbl1\n" + "(k1 int, k2 float)\n" + "duplicate key(k1)\n"
|
||||
+ "distributed by hash(k2) buckets 1\n" + "properties('replication_num' = '1'); "));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user