Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix](RoutineLoad)Fix when Unique (MoW) RoutineLoad imports unspecified Sequence column #23167

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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();
Expand Down
Loading