File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -163,4 +163,8 @@ impl Dialect for GenericDialect {
163163 fn supports_comma_separated_set_assignments ( & self ) -> bool {
164164 true
165165 }
166+
167+ fn supports_filter_during_aggregation ( & self ) -> bool {
168+ true
169+ }
166170}
Original file line number Diff line number Diff line change @@ -11642,16 +11642,28 @@ fn parse_connect_by() {
1164211642
1164311643#[ test]
1164411644fn test_selective_aggregation ( ) {
11645+ let testing_dialects = all_dialects_where ( |d| d. supports_filter_during_aggregation ( ) ) ;
11646+ let expected_dialects: Vec < Box < dyn Dialect > > = vec ! [
11647+ Box :: new( PostgreSqlDialect { } ) ,
11648+ Box :: new( DatabricksDialect { } ) ,
11649+ Box :: new( HiveDialect { } ) ,
11650+ Box :: new( SQLiteDialect { } ) ,
11651+ Box :: new( DuckDbDialect { } ) ,
11652+ Box :: new( GenericDialect { } ) ,
11653+ ] ;
11654+ assert_eq ! ( testing_dialects. dialects. len( ) , expected_dialects. len( ) ) ;
11655+ expected_dialects
11656+ . into_iter ( )
11657+ . for_each ( |d| assert ! ( d. supports_filter_during_aggregation( ) ) ) ;
11658+
1164511659 let sql = concat ! (
1164611660 "SELECT " ,
1164711661 "ARRAY_AGG(name) FILTER (WHERE name IS NOT NULL), " ,
1164811662 "ARRAY_AGG(name) FILTER (WHERE name LIKE 'a%') AS agg2 " ,
1164911663 "FROM region"
1165011664 ) ;
1165111665 assert_eq ! (
11652- all_dialects_where( |d| d. supports_filter_during_aggregation( ) )
11653- . verified_only_select( sql)
11654- . projection,
11666+ testing_dialects. verified_only_select( sql) . projection,
1165511667 vec![
1165611668 SelectItem :: UnnamedExpr ( Expr :: Function ( Function {
1165711669 name: ObjectName :: from( vec![ Ident :: new( "ARRAY_AGG" ) ] ) ,
You can’t perform that action at this time.
0 commit comments