branch-2.1: proper planning of shadow columns for load and schema change concurrent execution (#49332) (#50710)
This commit is contained in:
@ -292,11 +292,15 @@ public class BindSink implements AnalysisRuleFactory {
|
||||
Map<Expression, Expression> replaceMap = Maps.newHashMap();
|
||||
NereidsParser expressionParser = new NereidsParser();
|
||||
List<Column> materializedViewColumn = Lists.newArrayList();
|
||||
List<Column> shadowColumns = Lists.newArrayList();
|
||||
// generate slots not mentioned in sql, mv slots and shaded slots.
|
||||
for (Column column : boundSink.getTargetTable().getFullSchema()) {
|
||||
if (column.isMaterializedViewColumn()) {
|
||||
materializedViewColumn.add(column);
|
||||
continue;
|
||||
} else if (Column.isShadowColumn(column.getName())) {
|
||||
shadowColumns.add(column);
|
||||
continue;
|
||||
}
|
||||
if (columnToChildOutput.containsKey(column)
|
||||
// do not process explicitly use DEFAULT value here:
|
||||
@ -423,6 +427,15 @@ public class BindSink implements AnalysisRuleFactory {
|
||||
columnToOutput.put(column.getName(), output);
|
||||
}
|
||||
}
|
||||
for (Column column : shadowColumns) {
|
||||
NamedExpression expression = columnToOutput.get(column.getNonShadowName());
|
||||
if (expression != null) {
|
||||
Alias alias = (Alias) expression;
|
||||
Expression newExpr = TypeCoercionUtils.castIfNotSameType(alias.child(),
|
||||
DataType.fromCatalogType(column.getType()));
|
||||
columnToOutput.put(column.getName(), new Alias(newExpr, column.getName()));
|
||||
}
|
||||
}
|
||||
return columnToOutput;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user