bp #39744
This commit is contained in:
@ -1307,8 +1307,9 @@ public class InternalCatalog implements CatalogIf<Database> {
|
||||
if (resultExpr.getSrcSlotRef() != null
|
||||
&& resultExpr.getSrcSlotRef().getTable() != null
|
||||
&& !resultExpr.getSrcSlotRef().getTable().isManagedTable()) {
|
||||
if (createTableStmt.getPartitionDesc().inIdentifierPartitions(
|
||||
resultExpr.getSrcSlotRef().getColumnName())
|
||||
if ((createTableStmt.getPartitionDesc() != null
|
||||
&& createTableStmt.getPartitionDesc().inIdentifierPartitions(
|
||||
resultExpr.getSrcSlotRef().getColumnName()))
|
||||
|| (createTableStmt.getDistributionDesc() != null
|
||||
&& createTableStmt.getDistributionDesc().inDistributionColumns(
|
||||
resultExpr.getSrcSlotRef().getColumnName()))) {
|
||||
|
||||
@ -123,6 +123,8 @@ public class CreateTableCommand extends Command implements ForwardWithSync {
|
||||
Slot s = slots.get(i);
|
||||
DataType dataType = s.getDataType().conversion();
|
||||
if (i == 0 && dataType.isStringType()) {
|
||||
// first column of olap table can not be string type.
|
||||
// So change it to varchar type.
|
||||
dataType = VarcharType.createVarcharType(ScalarType.MAX_VARCHAR_LENGTH);
|
||||
} else {
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
@ -135,13 +137,21 @@ public class CreateTableCommand extends Command implements ForwardWithSync {
|
||||
if (createTableInfo.getPartitionTableInfo().inIdentifierPartitions(s.getName())
|
||||
|| (createTableInfo.getDistribution() != null
|
||||
&& createTableInfo.getDistribution().inDistributionColumns(s.getName()))) {
|
||||
// String type can not be used in partition/distributed column
|
||||
// String type can not be used in partition/distributed column,
|
||||
// so we replace it to varchar
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharacterType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
} else {
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharacterType.class, StringType.INSTANCE);
|
||||
if (i == 0) {
|
||||
// first column of olap table can not be string type.
|
||||
// So change it to varchar type.
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharacterType.class, VarcharType.MAX_VARCHAR_TYPE);
|
||||
} else {
|
||||
// change varchar/char column from external table to string type
|
||||
dataType = TypeCoercionUtils.replaceSpecifiedType(dataType,
|
||||
CharacterType.class, StringType.INSTANCE);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -212,3 +222,4 @@ public class CreateTableCommand extends Command implements ForwardWithSync {
|
||||
return createTableInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user