You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2024/02/09 09:39:25 UTC

(doris) branch branch-1.2-lts updated: [fix](fe rest api)api gets execution plan, table name case problem (#25112) (#31012)

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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new 5df46b735e1 [fix](fe rest api)api gets execution plan, table name case problem (#25112) (#31012)
5df46b735e1 is described below

commit 5df46b735e18d29e50b92227e39bd795bd21fa51
Author: Mingyu Chen <mo...@163.com>
AuthorDate: Fri Feb 9 17:39:19 2024 +0800

    [fix](fe rest api)api gets execution plan, table name case problem (#25112) (#31012)
    
    bp #25112
---
 .../doris/httpv2/rest/TableQueryPlanAction.java      | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 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 2a8d4cc0157..86a19eea303 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
@@ -34,6 +34,7 @@ import org.apache.doris.planner.PlanFragment;
 import org.apache.doris.planner.Planner;
 import org.apache.doris.planner.ScanNode;
 import org.apache.doris.qe.ConnectContext;
+import org.apache.doris.qe.GlobalVariable;
 import org.apache.doris.qe.OriginStatement;
 import org.apache.doris.qe.StmtExecutor;
 import org.apache.doris.thrift.TDataSink;
@@ -186,10 +187,21 @@ public class TableQueryPlanAction extends RestBaseController {
         // check consistent http requested resource with sql referenced
         // if consistent in this way, can avoid check privilege
         TableName tableAndDb = fromTables.get(0).getName();
-        if (!(tableAndDb.getDb().equals(requestDb) && tableAndDb.getTbl().equals(requestTable))) {
-            throw new DorisHttpException(HttpResponseStatus.BAD_REQUEST,
-                    "requested database and table must consistent with sql: request [ "
-                    + requestDb + "." + requestTable + "]" + "and sql [" + tableAndDb.toString() + "]");
+        int lower = GlobalVariable.lowerCaseTableNames;
+        //Determine whether table names are case-sensitive
+        if (lower == 0) {
+            if (!(tableAndDb.getDb().equals(requestDb) && tableAndDb.getTbl().equals(requestTable))) {
+                throw new DorisHttpException(HttpResponseStatus.BAD_REQUEST,
+                        "requested database and table must consistent with sql: request [ "
+                                + requestDb + "." + requestTable + "]" + "and sql [" + tableAndDb.toString() + "]");
+            }
+        } else {
+            if (!(tableAndDb.getDb().equalsIgnoreCase(requestDb)
+                    && tableAndDb.getTbl().equalsIgnoreCase(requestTable))) {
+                throw new DorisHttpException(HttpResponseStatus.BAD_REQUEST,
+                        "requested database and table must consistent with sql: request [ "
+                                + requestDb + "." + requestTable + "]" + "and sql [" + tableAndDb.toString() + "]");
+            }
         }
 
         // acquired Planner to get PlanNode and fragment templates


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