morningman commented on code in PR #23393:
URL: https://github.com/apache/doris/pull/23393#discussion_r1304475849


##########
regression-test/suites/external_table_p2/tvf/test_tvf_view_count_p2.groovy:
##########
@@ -0,0 +1,39 @@
+// 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_tvf_view_count_p2", 
"p2,external,tvf,external_remote,external_remote_tvf") {
+    String enabled = context.config.otherConfigs.get("enableExternalHiveTest")
+    if (enabled != null && enabled.equalsIgnoreCase("true")) {
+        String nameNodeHost = context.config.otherConfigs.get("extHiveHmsHost")
+        String hdfsPort = context.config.otherConfigs.get("extHdfsPort")
+
+        sql """drop database if exists test_tvf_view_count_p2"""
+        sql """create database test_tvf_view_count_p2"""
+        sql """use test_tvf_view_count_p2"""
+        sql """set enable_nereids_planner=false"""
+        sql """create view tvf_view_count as select * from hdfs (
+            
"uri"="hdfs://${nameNodeHost}:${hdfsPort}:/usr/hive/warehouse/tpch_1000_parquet.db/part/000091_0",
+            "fs.defaultFS"="hdfs://${nameNodeHost}:${hdfsPort}",
+            "hadoop.username" = "hadoop",
+            "format"="parquet");"""
+
+        qt_6 """explain verbose select count(1) from tvf_view_count;"""

Review Comment:
   you can use `explain` action to check.
   eg: regression-test/suites/rollup/test_materialized_view_date.groovy
   search `explain`



##########
fe/fe-core/src/main/java/org/apache/doris/analysis/Expr.java:
##########
@@ -2505,9 +2505,12 @@ public boolean refToCountStar() {
                 if (e instanceof FunctionCallExpr) {
                     FunctionCallExpr funcExpr = (FunctionCallExpr) e;
                     Function f = funcExpr.fn;
-                    if (f.getFunctionName().getFunction().equals("count")
-                            && 
funcExpr.children.stream().anyMatch(Expr::isConstant)) {
-                        return true;
+                    if (f.getFunctionName().getFunction().equals("count")) {

Review Comment:
   Add some comment to explain this logic



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to