This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit efce8d828a7a6deb0bbee0d954e9b3a0067e797d 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 f3379355708..0bd83617f12 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