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

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 505c9f75042 [fix](load) Fix missing cloud cluster name for 
TableQueryPlanAction for spark load (#33289)
505c9f75042 is described below

commit 505c9f75042fba33e1b44d642333a2f2d9552685
Author: Gavin Chou <gavineaglec...@gmail.com>
AuthorDate: Tue Apr 9 21:57:24 2024 +0800

    [fix](load) Fix missing cloud cluster name for TableQueryPlanAction for 
spark load (#33289)
---
 .../org/apache/doris/httpv2/rest/TableQueryPlanAction.java  |  4 ++++
 .../src/main/java/org/apache/doris/qe/ConnectContext.java   | 13 +++++++------
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/TableQueryPlanAction.java
 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/TableQueryPlanAction.java
index d377ba2e5f6..6188b502692 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/TableQueryPlanAction.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/httpv2/rest/TableQueryPlanAction.java
@@ -26,6 +26,7 @@ import org.apache.doris.catalog.Database;
 import org.apache.doris.catalog.Env;
 import org.apache.doris.catalog.Table;
 import org.apache.doris.catalog.TableIf;
+import org.apache.doris.common.Config;
 import org.apache.doris.common.DorisHttpException;
 import org.apache.doris.common.MetaNotFoundException;
 import org.apache.doris.common.util.NetUtils;
@@ -131,6 +132,9 @@ public class TableQueryPlanAction extends 
RestBaseController {
                     // TODO support it
                     
ConnectContext.get().getSessionVariable().setEnableTwoPhaseReadOpt(false);
                 }
+                if (Config.isCloudMode()) { // Choose a cluster to for this 
query
+                    ConnectContext.get().getCurrentCloudCluster();
+                }
                 // parse/analysis/plan the sql and acquire tablet distributions
                 handleQuery(ConnectContext.get(), fullDbName, tblName, sql, 
resultMap);
             } finally {
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java 
b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
index be6c7104786..5188eae3dfe 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java
@@ -1150,13 +1150,14 @@ public class ConnectContext {
     }
 
     /**
-     * @param updateErr whether set this connect state to error when the 
returned cluster is null or empty.
+     * Tries to choose an available cluster in the following order
+     * 1. Do nothing if a cluster has been chosen for current session. It may 
be
+     *    chosen explicitly by `use @` command or setCloudCluster() or this 
method
+     * 2. Tries to choose a default cluster if current mysql user has been set 
any
+     * 3. Tries to choose an authorized cluster if all preceeding conditions 
failed
      *
-     * @return Returns an available cluster in the following order
-     *         1 Use an explicitly specified cluster
-     *         2 If no cluster is specified, the user's default cluster is used
-     *         3 If the user does not have a default cluster, select a cluster 
with permissions for the user
-     *         Returns null when there is no available cluster
+     * @param updateErr whether set the connect state to error if the returned 
cluster is null or empty
+     * @return non-empty cluster name if a cluster has been chosen otherwise 
null or empty string
      */
     public String getCloudCluster(boolean updateErr) {
         if (!Config.isCloudMode()) {


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

Reply via email to