This is an automated email from the ASF dual-hosted git repository.

gavinchou pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new d8170c5aa2e branch-3.0: [fix](export) Make enable_outfile_to_local 
available for export command #45241 (#45514)
d8170c5aa2e is described below

commit d8170c5aa2e704db44a80db1f4c3465a1cf8eeb3
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Dec 19 02:00:50 2024 +0800

    branch-3.0: [fix](export) Make enable_outfile_to_local available for export 
command #45241 (#45514)
    
    Cherry-picked from #45241
    
    Co-authored-by: Siyang Tang <tangsiy...@selectdb.com>
---
 fe/fe-core/src/main/java/org/apache/doris/analysis/ExportStmt.java  | 6 ++++++
 .../apache/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 1ca6c4e3f5b..cba01d22fca 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 implements 
NotFallbackInParser {
     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 c5d61f58586..b08c6a6b54a 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
@@ -140,6 +140,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);
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to