This is an automated email from the ASF dual-hosted git repository.
morrysnow 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 80673406b1 [fix](Nereids) project hidden columns when
show_hidden_columns is true (#22285)
80673406b1 is described below
commit 80673406b11060a5aab1346b8b1b0c844f855c77
Author: 谢健 <[email protected]>
AuthorDate: Fri Jul 28 15:08:18 2023 +0800
[fix](Nereids) project hidden columns when show_hidden_columns is true
(#22285)
---
.../doris/nereids/rules/analysis/SlotBinder.java | 5 ++-
.../nereids_p0/test_selelct_hidden_col.groovy | 40 ++++++++++++++++++++++
2 files changed, 44 insertions(+), 1 deletion(-)
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 e5f13007bd..94c4b4f07d 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
@@ -17,6 +17,7 @@
package org.apache.doris.nereids.rules.analysis;
+import org.apache.doris.common.util.Util;
import org.apache.doris.nereids.CascadesContext;
import org.apache.doris.nereids.analyzer.Scope;
import org.apache.doris.nereids.analyzer.UnboundAlias;
@@ -131,9 +132,11 @@ class SlotBinder extends SubExprAnalyzer {
@Override
public Expression visitUnboundStar(UnboundStar unboundStar,
CascadesContext context) {
List<String> qualifier = unboundStar.getQualifier();
+ boolean showHidden = Util.showHiddenColumns();
List<Slot> slots = getScope().getSlots()
.stream()
- .filter(slot -> !(slot instanceof SlotReference) ||
((SlotReference) slot).isVisible())
+ .filter(slot -> !(slot instanceof SlotReference)
+ || (((SlotReference) slot).isVisible()) || showHidden)
.collect(Collectors.toList());
switch (qualifier.size()) {
case 0: // select *
diff --git a/regression-test/suites/nereids_p0/test_selelct_hidden_col.groovy
b/regression-test/suites/nereids_p0/test_selelct_hidden_col.groovy
new file mode 100644
index 0000000000..b9d2d669f9
--- /dev/null
+++ b/regression-test/suites/nereids_p0/test_selelct_hidden_col.groovy
@@ -0,0 +1,40 @@
+// 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_select_hidden") {
+ sql "SET enable_nereids_planner=true"
+ sql "SET enable_fallback_to_original_planner=false"
+ sql "set show_hidden_columns=true;"
+ sql """
+ CREATE TABLE IF NOT EXISTS hidden_tb (
+ `uid` BIGINT NULL,
+ `v1` BIGINT NULL
+ )
+ UNIQUE KEY(uid)
+ DISTRIBUTED BY HASH(uid) BUCKETS 3
+ PROPERTIES (
+ "enable_unique_key_merge_on_write" = "true",
+ "replication_num" = "1"
+ );
+ """
+ explain {
+ sql("select * from hidden_tb")
+ contains "__DORIS_VERSION_COL__"
+ }
+
+ sql "drop table if exists hidden_tb"
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]