This is an automated email from the ASF dual-hosted git repository. yiguolei 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 03316e2355 [fix](fe rest api)api gets execution plan, table name case problem (#25112) 03316e2355 is described below commit 03316e235530d85063255513d7c8d23583997222 Author: jiafeng.zhang <zhang...@gmail.com> AuthorDate: Sat Oct 14 06:48:24 2023 -0500 [fix](fe rest api)api gets execution plan, table name case problem (#25112) The user has configured the parameter lower_case_table_names, which ignores the case of the table name. When executed on the SQL client, the table name can be queried in both case. But when using Connector to read doris data, the table names must be in the same case, otherwise an error will be reported. --- .../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 f337935570..0bd83617f1 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 @@ -35,6 +35,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; @@ -197,10 +198,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-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org