jackwener commented on code in PR #6647: URL: https://github.com/apache/arrow-datafusion/pull/6647#discussion_r1226528770
########## datafusion/core/tests/sqllogictests/test_files/wildcard.slt: ########## @@ -108,6 +108,51 @@ SELECT t1.*, tb2.* FROM t1 JOIN t2 tb2 ON t2_id = t1_id ORDER BY t1_id statement error Error during planning: Invalid qualifier agg SELECT agg.* FROM aggregate_simple ORDER BY c1 +# test_count_wildcard_on_with +query I +with tbl as (SELECT 0 as 'COUNT(*)') SELECT * from tbl +---- +0 + +# test_count_wildcard_on_with_logical_plan +query TT +explain with tbl as (SELECT 0 as 'COUNT(*)') SELECT * from tbl +---- +logical_plan +Projection: tbl.COUNT(UInt8(1)) AS tbl.COUNT(*) +--SubqueryAlias: tbl +----Projection: Int64(0) AS COUNT(UInt8(1)) +------EmptyRelation +physical_plan +ProjectionExec: expr=[COUNT(UInt8(1))@0 as tbl.COUNT(*)] +--ProjectionExec: expr=[0 as COUNT(UInt8(1))] +----EmptyExec: produce_one_row=true + + +# test_count_wildcard_on_with_agg +query I +with tbl as (SELECT count(a) as 'COUNT(*)' from (values (1), (2)) as x(a)) SELECT * from tbl; +---- +2 + +# test_count_wildcard_on_with_agg_logical_plan +query TT +explain with tbl as (SELECT count(a) as 'COUNT(*)' from (values (1), (2)) as x(a)) SELECT * from tbl; +---- +logical_plan +Projection: tbl.COUNT(UInt8(1)) AS tbl.COUNT(*) +--SubqueryAlias: tbl +----Projection: COUNT(a) AS COUNT(UInt8(1)) Review Comment: look like SubqueryAlias block optimization, We need a `EliminateSubqueryAlias` rule #5407, I will try to do it. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
