From 100cea16d91ff82ecaf1dc065e7f90e2f738618a Mon Sep 17 00:00:00 2001 From: starocean999 <40539150+starocean999@users.noreply.github.com> Date: Thu, 22 Feb 2024 19:55:43 +0800 Subject: [PATCH] [fix](nereids)show error message if use wrong alias to bind the table (#31264) --- .../apache/doris/nereids/rules/analysis/SlotBinder.java | 3 +++ .../suites/nereids_rules_p0/bind_relation/bind_view.groovy | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SlotBinder.java b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SlotBinder.java index 5c96ff8bd2..7f6e23a120 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SlotBinder.java +++ b/fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SlotBinder.java @@ -260,6 +260,9 @@ public class SlotBinder extends SubExprAnalyzer { } }).collect(Collectors.toList()); + if (slots.isEmpty()) { + throw new AnalysisException("unknown qualifier: " + StringUtils.join(qualifierStar, ".") + ".*"); + } return new BoundStar(slots); } diff --git a/regression-test/suites/nereids_rules_p0/bind_relation/bind_view.groovy b/regression-test/suites/nereids_rules_p0/bind_relation/bind_view.groovy index b69fddad1d..45d55d83e3 100644 --- a/regression-test/suites/nereids_rules_p0/bind_relation/bind_view.groovy +++ b/regression-test/suites/nereids_rules_p0/bind_relation/bind_view.groovy @@ -49,6 +49,13 @@ suite("test_bind_view") { ); """ + test { + sql """ + select ggg.* from ( select * from ${table_name} ) l; + """ + exception "unknown qualifier:" + } + try { sql """