Skip to content

test: cover a cast inside an aggregate's argument - #6404

Merged
max-sixty merged 1 commit into
mainfrom
test/cast-inside-aggregate
Oct 4, 2026
Merged

max-sixty merged 1 commit into
mainfrom
test/cast-inside-aggregate

Conversation

@prql-bot

@prql-bot prql-bot commented Oct 4, 2026

Copy link
Copy Markdown
Collaborator

#3534 reported that sum (artist_id | as int) inside aggregate failed to type-check (function std.sum, param `column` expected type `array`, but found type `scalar` ), while the same cast moved into a preceding derive worked. On current main the issue's query compiles to exactly the SQL it asked for:

SELECT
  COALESCE(SUM(CAST(artist_id AS int)), 0) AS total_int,
  COALESCE(SUM(CAST(artist_id AS int)), 0) AS total_cast
FROM
  artists

The likely fix is #5111, which dropped the <scalar> return type from std.as (read from that diff, not bisected). No test passes a cast to an aggregate, so this adds test_aggregate_of_cast to prqlc/prqlc/tests/integration/sql.rs with the issue's query, next to the similar test_aggregate_of_expression from #6400.

Test-only change, so no changelog entry.

Closes #3534

@max-sixty
max-sixty merged commit f6ec03e into main Oct 4, 2026
35 checks passed
@max-sixty
max-sixty deleted the test/cast-inside-aggregate branch October 4, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cast inside aggregation fails with type error

2 participants