From 7f8ec3e679063649f3eb48b68ea0f7111b138ce4 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 19 Dec 2024 14:08:33 +0800 Subject: [PATCH] branch-2.1: [fix](export) Make enable_outfile_to_local available for export command #45241 (#45515) Cherry-picked from #45241 Co-authored-by: Siyang Tang --- .../src/main/java/org/apache/doris/analysis/ExportStmt.java | 6 ++++++ .../doris/nereids/trees/plans/commands/ExportCommand.java | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java index a25aa49777..a2d3108ad0 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java +++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java @@ -47,6 +47,7 @@ import lombok.Getter; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.UUID; @@ -146,6 +147,11 @@ public class ExportStmt extends StatementBase { public void analyze(Analyzer analyzer) throws UserException { super.analyze(analyzer); + if (!Config.enable_outfile_to_local && Objects.requireNonNull(path) + .startsWith(OutFileClause.LOCAL_FILE_PREFIX)) { + throw new AnalysisException("`enable_outfile_to_local` = false, exporting file to local fs is disabled."); + } + tableRef = analyzer.resolveTableRef(tableRef); Preconditions.checkNotNull(tableRef); tableRef.analyze(analyzer); diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExportCommand.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExportCommand.java index 13ac73856b..c0c0f7e6e5 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExportCommand.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExportCommand.java @@ -139,6 +139,10 @@ public class ExportCommand extends Command implements ForwardWithSync { tblName.getDb() + ": " + tblName.getTbl()); } + if (!Config.enable_outfile_to_local && path.startsWith(OutFileClause.LOCAL_FILE_PREFIX)) { + throw new AnalysisException("`enable_outfile_to_local` = false, exporting file to local fs is disabled."); + } + // check phases checkAllParameters(ctx, tblName, fileProperties);