[fix](Nereids) unique table support bitmap column (#25160)

This commit is contained in:
morrySnow
2023-10-09 15:39:11 +08:00
committed by GitHub
parent 4f7fad5498
commit 0bf954ba05
2 changed files with 26 additions and 5 deletions

View File

@ -142,12 +142,20 @@ public class ColumnDefinition {
throw new AnalysisException("Type exceeds the maximum nesting depth of 9");
}
}
if (type.isBitmapType() || type.isHllType() || type.isQuantileStateType()) {
if (type.isHllType() || type.isQuantileStateType()) {
if (aggType == null) {
throw new AnalysisException("complex type have to use aggregate function: " + name);
throw new AnalysisException("column: " + name + " must be used in AGG_KEYS.");
}
isNullable = false;
}
if (type.isBitmapType()) {
if (keysType == KeysType.DUP_KEYS) {
throw new AnalysisException("column:" + name + " must be used in AGG_KEYS or UNIQUE_KEYS.");
}
if (aggType != null) {
isNullable = false;
}
}
if (keysSet.contains(name)) {
isKey = true;
if (aggType != null) {

View File

@ -34,6 +34,7 @@ import org.apache.doris.catalog.Type;
import org.apache.doris.cluster.ClusterNamespace;
import org.apache.doris.common.Config;
import org.apache.doris.common.FeConstants;
import org.apache.doris.common.FeNameFormat;
import org.apache.doris.common.util.PropertyAnalyzer;
import org.apache.doris.nereids.exceptions.AnalysisException;
import org.apache.doris.nereids.types.DataType;
@ -160,6 +161,15 @@ public class CreateTableInfo {
properties = Maps.newHashMap();
}
try {
FeNameFormat.checkTableName(tableName);
if (dbName != null) {
FeNameFormat.checkDbName(dbName);
}
} catch (Exception e) {
throw new AnalysisException(e.getMessage(), e);
}
// analyze table name
if (dbName == null) {
dbName = ClusterNamespace.getFullName(ctx.getClusterName(), ctx.getDatabase());
@ -314,9 +324,12 @@ public class CreateTableInfo {
}
partitionNames.add(partitionName);
}
Set<String> partitionColumnSets = Sets.newHashSet(partitionColumns);
if (partitionColumnSets.size() != partitionColumns.size()) {
throw new AnalysisException("Duplicate partition keys is not allowed");
Set<String> partitionColumnSets = Sets.newHashSet();
List<String> duplicatesKeys = partitionColumns.stream()
.filter(c -> !partitionColumnSets.add(c))
.collect(Collectors.toList());
if (!duplicatesKeys.isEmpty()) {
throw new AnalysisException("Duplicated partition column " + duplicatesKeys.get(0));
}
partitions.forEach(p -> {
p.setPartitionTypes(partitionColumns.stream().map(s -> columnMap.get(s).getType())