From 684759213789ee34636519ac57214fed67ec5528 Mon Sep 17 00:00:00 2001 From: Calvin Kirs Date: Fri, 18 Aug 2023 21:49:09 +0800 Subject: [PATCH] [Fix](RoutineLoad)Fix when Unique (MoW) RoutineLoad imports unspecified Sequence column (#23167) [Fix](RoutineLoad)Fix when Unique (MoW) routineload imports unspecified Sequence column --- .../doris/planner/external/LoadScanProvider.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/external/LoadScanProvider.java b/fe/fe-core/src/main/java/org/apache/doris/planner/external/LoadScanProvider.java index 9089f0c2c76758..25be5de433ac68 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/external/LoadScanProvider.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/external/LoadScanProvider.java @@ -190,7 +190,7 @@ private void initColumns(FileLoadScanNode.ParamCreateContext context, Analyzer a .filter(c -> c.getColumnName().equalsIgnoreCase(finalSequenceCol)).findAny(); // if `columnDescs.descs` is empty, that means it's not a partial update load, and user not specify // column name. - if (foundCol.isPresent() || columnDescs.descs.isEmpty()) { + if (foundCol.isPresent() || shouldAddSequenceColumn(columnDescs)) { columnDescs.descs.add(new ImportColumnDesc(Column.SEQUENCE_COL, new SlotRef(null, sequenceCol))); } else if (!fileGroupInfo.isPartialUpdate()) { @@ -226,6 +226,17 @@ private void initColumns(FileLoadScanNode.ParamCreateContext context, Analyzer a } } + /** + * if not set sequence column and column size is null or only have deleted sign ,return true + */ + private boolean shouldAddSequenceColumn(LoadTaskInfo.ImportColumnDescs columnDescs) { + if (columnDescs.descs.isEmpty()) { + return true; + } + return columnDescs.descs.size() == 1 && columnDescs.descs.get(0).getColumnName() + .equalsIgnoreCase(Column.DELETE_SIGN); + } + private TFileFormatType formatType(String fileFormat, String path) throws UserException { if (fileFormat != null) { String lowerFileFormat = fileFormat.toLowerCase();