[branch-2.1](test) fix some tests in external p0 (#36127)

Also move the analysis exception of "Not support insert with partition
spec in hive catalog."
from create sink phase to bind sink phase.
So that when `set enable_fallback_to_original_planner=false;`, the
return error will be correct.
This commit is contained in:
Mingyu Chen
2024-06-11 22:15:28 +08:00
committed by GitHub
parent acbfcf7ad9
commit c78c7f6b45
4 changed files with 10 additions and 6 deletions

View File

@ -105,9 +105,6 @@ public class UnboundTableSinkCreator {
isPartialUpdate, dmlCommandType, Optional.empty(),
Optional.empty(), plan);
} else if (curCatalog instanceof HMSExternalCatalog && !isAutoDetectPartition) {
if (!partitions.isEmpty()) {
throw new AnalysisException("Not support insert with partition spec in hive catalog.");
}
return new UnboundHiveTableSink<>(nameParts, colNames, hints, partitions,
dmlCommandType, Optional.empty(), Optional.empty(), plan);
} else if (curCatalog instanceof IcebergExternalCatalog && !isAutoDetectPartition) {

View File

@ -391,6 +391,10 @@ public class BindSink implements AnalysisRuleFactory {
HMSExternalTable table = pair.second;
LogicalPlan child = ((LogicalPlan) sink.child());
if (!sink.getPartitions().isEmpty()) {
throw new AnalysisException("Not support insert with partition spec in hive catalog.");
}
List<Column> bindColumns;
if (sink.getColNames().isEmpty()) {
bindColumns = table.getBaseSchema(true).stream().collect(ImmutableList.toImmutableList());
@ -399,7 +403,7 @@ public class BindSink implements AnalysisRuleFactory {
Column column = table.getColumn(cn);
if (column == null) {
throw new AnalysisException(String.format("column %s is not found in table %s",
cn, table.getName()));
cn, table.getName()));
}
return column;
}).collect(ImmutableList.toImmutableList());