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 2023/11/16 04:23:45 UTC
(doris) branch master updated: [Fix](nereids)Fix nereids fail to parse tablesample rows bug (#26981)
This is an automated email from the ASF dual-hosted git repository.
morningman 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 343d58123d3 [Fix](nereids)Fix nereids fail to parse tablesample rows bug (#26981)
343d58123d3 is described below
commit 343d58123d3dd77beb35f2f3a9edaf99dcb47762
Author: Jibing-Li <64...@users.noreply.github.com>
AuthorDate: Thu Nov 16 12:23:37 2023 +0800
[Fix](nereids)Fix nereids fail to parse tablesample rows bug (#26981)
---
.../doris/nereids/parser/LogicalPlanBuilder.java | 2 +-
.../java/org/apache/doris/qe/StmtExecutor.java | 3 +-
.../hive/test_hive_tablesample_p0.groovy | 50 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 33f11c4687f..13a4b7503e0 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -2890,7 +2890,7 @@ public class LogicalPlanBuilder extends DorisParserBaseVisitor<Object> {
return new TableSample(percent, true, seek);
}
SampleByRowsContext sampleByRowsContext = (SampleByRowsContext) sampleContext;
- long rows = Long.parseLong(sampleByRowsContext.ROWS().getText());
+ long rows = Long.parseLong(sampleByRowsContext.INTEGER_VALUE().getText());
return new TableSample(rows, false, seek);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index b52890ede06..f77a3b9fdca 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -2666,8 +2666,7 @@ public class StmtExecutor {
planner = new NereidsPlanner(statementContext);
planner.plan(parsedStmt, context.getSessionVariable().toThrift());
} catch (Exception e) {
- LOG.warn("Arrow Flight SQL fall back to legacy planner, because: {}",
- e.getMessage(), e);
+ LOG.warn("Fall back to legacy planner, because: {}", e.getMessage(), e);
parsedStmt = null;
planner = null;
context.getState().setNereids(false);
diff --git a/regression-test/suites/external_table_p0/hive/test_hive_tablesample_p0.groovy b/regression-test/suites/external_table_p0/hive/test_hive_tablesample_p0.groovy
new file mode 100644
index 00000000000..2594b02bf1d
--- /dev/null
+++ b/regression-test/suites/external_table_p0/hive/test_hive_tablesample_p0.groovy
@@ -0,0 +1,50 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+suite("test_hive_tablesample_p0", "all_types,p0,external,hive,external_docker,external_docker_hive") {
+
+ String enabled = context.config.otherConfigs.get("enableHiveTest")
+ if (enabled != null && enabled.equalsIgnoreCase("true")) {
+ try {
+ String hms_port = context.config.otherConfigs.get("hms_port")
+ String catalog_name = "test_hive_tablesample_p0"
+ String externalEnvIp = context.config.otherConfigs.get("externalEnvIp")
+
+ sql """drop catalog if exists ${catalog_name}"""
+ sql """create catalog if not exists ${catalog_name} properties (
+ "type"="hms",
+ 'hive.metastore.uris' = 'thrift://${externalEnvIp}:${hms_port}'
+ );"""
+ sql """use `${catalog_name}`.`default`"""
+ sql """SET enable_nereids_planner=true"""
+ sql """SET enable_fallback_to_original_planner=false"""
+ sql """select count(*) from student tablesample(10 rows);"""
+ sql """select count(*) from student tablesample(10 percent);"""
+ explain {
+ sql("select count(*) from student tablesample(10 rows);")
+ contains "count(*)[#7]"
+ }
+ explain {
+ sql("select count(*) from student tablesample(10 percent);")
+ contains "count(*)[#7]"
+ }
+ sql """drop catalog if exists ${catalog_name}"""
+ } finally {
+ }
+ }
+}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org