File tree 2 files changed +19
-3
lines changed
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 {
163
163
fn supports_comma_separated_set_assignments ( & self ) -> bool {
164
164
true
165
165
}
166
+
167
+ fn supports_filter_during_aggregation ( & self ) -> bool {
168
+ true
169
+ }
166
170
}
Original file line number Diff line number Diff line change @@ -11642,16 +11642,28 @@ fn parse_connect_by() {
11642
11642
11643
11643
#[ test]
11644
11644
fn 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
+
11645
11659
let sql = concat ! (
11646
11660
"SELECT " ,
11647
11661
"ARRAY_AGG(name) FILTER (WHERE name IS NOT NULL), " ,
11648
11662
"ARRAY_AGG(name) FILTER (WHERE name LIKE 'a%') AS agg2 " ,
11649
11663
"FROM region"
11650
11664
) ;
11651
11665
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,
11655
11667
vec![
11656
11668
SelectItem :: UnnamedExpr ( Expr :: Function ( Function {
11657
11669
name: ObjectName :: from( vec![ Ident :: new( "ARRAY_AGG" ) ] ) ,
You can’t perform that action at this time.
0 commit comments