Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley committed Dec 20, 2024
1 parent eac8dac commit 5aff3af
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ type Redshift_Dialect
_ = [op_kind, args]
expression

cast_aggregate_columns self op_kind:Text columns:(Vector Internal_Column) =
self.cast_op_type op_kind columns (SQL_Expression.Operation op_kind (columns.map c->c.expression))

## PRIVATE
prepare_fetch_types_query : SQL_Expression -> Context -> SQL_Statement
prepare_fetch_types_query self expression context =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ from project.Errors import Aggregagtion_Requires_Order
make_aggregate_column : DB_Table -> Aggregate_Column -> Text -> Dialect -> (Text -> Vector -> SQL_Expression -> SQL_Type_Reference) -> Problem_Builder -> Internal_Column
make_aggregate_column table aggregate as dialect infer_return_type problem_builder -> Internal_Column =
simple_aggregate op_kind columns =
expression = SQL_Expression.Operation op_kind (columns.map c->(dialect.cast_op_type op_kind columns c.expression))
expression = dialect.cast_aggregate_columns op_kind columns
sql_type_ref = infer_return_type op_kind columns expression
Internal_Column.Value as sql_type_ref expression

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ type Postgres_Dialect
if cast_to.is_nothing then expression else
SQL_Expression.Operation "CAST" [expression, SQL_Expression.Literal cast_to]

cast_aggregate_columns self op_kind:Text columns:(Vector Internal_Column) =
self.cast_op_type op_kind columns (SQL_Expression.Operation op_kind (columns.map c->c.expression))

## PRIVATE
prepare_fetch_types_query : SQL_Expression -> Context -> SQL_Statement
prepare_fetch_types_query self expression context =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@ type SQLite_Dialect
_ = [op_kind, args]
expression

cast_aggregate_columns self op_kind:Text columns:(Vector Internal_Column) =
self.cast_op_type op_kind columns (SQL_Expression.Operation op_kind (columns.map c->c.expression))

## PRIVATE
prepare_fetch_types_query : SQL_Expression -> Context -> SQL_Statement
prepare_fetch_types_query self expression context =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@ type SQLServer_Dialect
if cast_to.is_nothing then expression else
SQL_Expression.Operation "CAST" [expression, SQL_Expression.Literal cast_to]

cast_aggregate_columns self op_kind:Text columns:(Vector Internal_Column) =
SQL_Expression.Operation op_kind (columns.map c->(self.cast_op_type op_kind columns (Internals_Access.column_expression c)))

## PRIVATE
prepare_fetch_types_query : SQL_Expression -> Context -> SQL_Statement
prepare_fetch_types_query self expression context =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ type Snowflake_Dialect
_ = [op_kind, args]
expression

cast_aggregate_columns self op_kind:Text columns:(Vector Internal_Column) =
self.cast_op_type op_kind columns (SQL_Expression.Operation op_kind (columns.map c->c.expression))

## PRIVATE
prepare_fetch_types_query : SQL_Expression -> Context -> SQL_Statement
prepare_fetch_types_query self expression context =
Expand Down

0 comments on commit 5aff3af

Please sign in to comment.