Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@max-sixty
Copy link
Member

Summary

Fixes #4317 by replacing panic with a user-friendly error message when using from {} or from [].

Changes

  • Modified prqlc/prqlc/src/semantic/resolver/functions.rs to detect empty tuples/arrays and provide clear error messages
  • Updated test snapshots in bad_error_messages.rs to expect new error format

Before

The application panicked (crashed).
Message: called `Option::unwrap()` on a `None` value
Location: prqlc/prqlc/src/semantic/resolver/functions.rs:279

After

Error:
   ╭─[ :1:6 ]
   │
 1 │ from {}
   │      ─┬
   │       ╰── expected a table or query, but found an empty tuple `{}`
   │
   │ Help: an empty tuple cannot be used as a table
───╯

Test Plan

  • All tests pass (607 tests)
  • Handles both from {} and from [] cases
  • Doesn't break std.from_text with empty data (which properly sets lineage)
  • Code formatted with rustfmt

🤖 Generated with Claude Code

Replace panic with user-friendly error message when using `from {}` or `from []`.

Previously, the compiler would panic with "called Option::unwrap() on a None value"
when empty tuples or arrays were used as table arguments. Now it provides a clear
error message explaining that empty tuples/arrays cannot be used as tables.

The fix properly distinguishes between:
- Empty tuples/arrays used directly (shows clear error)
- Empty arrays from functions like std.from_text that set lineage (works correctly)

Closes PRQL#4317

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

Co-Authored-By: Claude <[email protected]>
@max-sixty max-sixty merged commit f903216 into PRQL:main Nov 17, 2025
36 checks passed
@max-sixty max-sixty deleted the 4317 branch November 17, 2025 22:40
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.

Compile crash on from {}

1 participant