Skip to content

fix: Handle lineage correctly when group pipeline simplifies to non-TransformCall#5584

Merged
max-sixty merged 1 commit intoPRQL:mainfrom
max-sixty:5092
Nov 29, 2025
Merged

fix: Handle lineage correctly when group pipeline simplifies to non-TransformCall#5584
max-sixty merged 1 commit intoPRQL:mainfrom
max-sixty:5092

Conversation

@max-sixty
Copy link
Copy Markdown
Member

Summary

Fixes #5092: ICE when using group with only sort (no take).

  • When sort_undone is true (inside a group), sorts are dropped
  • The original GROUP lineage was preserved with stale target_id references to expressions that no longer exist in the tree
  • This caused lookup_cid in lowering to fail with error code 3870

The fix conditionally chooses the lineage:

  • If pipeline remains a TransformCall (e.g., group + aggregate), use GROUP lineage which includes by columns
  • If pipeline simplified to non-TransformCall (e.g., sort dropped), use pipeline lineage to avoid stale references

Test plan

  • Added test_group_with_only_sort test case verifying the fix
  • All existing tests pass (615 tests)
  • Lints pass

🤖 Generated with Claude Code

…ransformCall

Fixes PRQL#5092: ICE when using group with only sort (no take).

When `sort_undone` is true (inside a group), sorts are dropped. The original
GROUP lineage was preserved with stale target_id references to expressions that
no longer exist in the tree. This caused `lookup_cid` in lowering to fail with
error code 3870.

The fix conditionally chooses the lineage:
- If pipeline remains a TransformCall (e.g., group + aggregate), use GROUP lineage
- If pipeline simplified to non-TransformCall (e.g., sort dropped), use pipeline lineage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit 98839cd into PRQL:main Nov 29, 2025
35 checks passed
@max-sixty max-sixty deleted the 5092 branch November 29, 2025 19:46
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.

Internal Compiler Error using group transform

1 participant