From 24c54d77c2868c9bdf3cbbdf777f631f3db84c93 Mon Sep 17 00:00:00 2001 From: bobhan1 Date: Tue, 17 Oct 2023 10:51:10 +0800 Subject: [PATCH] tmp --- .../glue/translator/PhysicalPlanTranslator.java | 10 ---------- .../doris/nereids/rules/analysis/BindSink.java | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java index fa906a74429e474..d023823fde9b926 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/glue/translator/PhysicalPlanTranslator.java @@ -379,16 +379,6 @@ public PlanFragment visitPhysicalOlapTableSink(PhysicalOlapTableSink foundCol = olapTableSink.getOutput().stream() - .filter(slot -> slot.getName().equalsIgnoreCase(olapTable.getSequenceMapCol())).findAny(); - if (!foundCol.isPresent() && !isPartialUpdate) { - throw new AnalysisException("Table " + olapTable.getName() - + " has sequence column, need to specify the sequence column"); - } - } - if (isPartialUpdate) { if (!olapTable.getEnableUniqueKeyMergeOnWrite()) { throw new AnalysisException("Partial update is only allowed in" diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java index 3537433129ef8cb..c75e4409b7f7527 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/BindSink.java @@ -107,6 +107,21 @@ public List buildRules() { throw new AnalysisException("insert into cols should be corresponding to the query output"); } + try { + if (table.hasSequenceCol() && table.getSequenceMapCol() != null && !boundSink.isPartialUpdate()) { + Column seqCol = table.getFullSchema().stream() + .filter(col -> col.getName().equals(table.getSequenceMapCol())) + .findFirst().get(); + if (seqCol.getDefaultValue() == null + || !seqCol.getDefaultValue().equals(DefaultValue.CURRENT_TIMESTAMP)) { + throw new AnalysisException("Table " + table.getName() + + " has sequence column, need to specify the sequence column"); + } + } + } catch (Exception e) { + throw new AnalysisException(e.getMessage(), e.getCause()); + } + Map columnToChildOutput = Maps.newHashMap(); for (int i = 0; i < boundSink.getCols().size(); ++i) { columnToChildOutput.put(boundSink.getCols().get(i), child.getOutput().get(i));