Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhelpful error with take -10 #4315

Open
2 tasks done
vanillajonathan opened this issue Mar 7, 2024 · 2 comments
Open
2 tasks done

Unhelpful error with take -10 #4315

vanillajonathan opened this issue Mar 7, 2024 · 2 comments

Comments

@vanillajonathan
Copy link
Collaborator

What happened?

I get an unhelpful error message.

Error:
    ╭─[std.prql:23:61]
    │
 23 │ let sub = left right -> <int || float || timestamp || date> internal std.sub
    │                                                             ────────┬───────
    │                                                                     ╰───────── expected a pipeline that resolves to a table, but found `internal std.sub`
    │
    │ Help: are you missing `from` statement?
────╯

PRQL input

from pets | take -10

SQL output

-- None

Expected SQL output

No response

MVCE confirmation

  • Minimal example
  • New issue

Anything else?

Earlier there was now resolved issue #1396.

@vanillajonathan vanillajonathan added the bug Invalid compiler output or panic label Mar 7, 2024
@max-sixty
Copy link
Member

Thanks! 

Could we add this to bad_error_messages.rs? Quoting from there on why that's a better way of managing these than GH issues:

//! Adding bad error messages here is also a welcome contribution. Probably
//! one-issue-per-error-message is not a good way of managing them — there would
//! be a huge number of issues, and it would be difficult to see what's current.
//! So instead, add the error message as a test here.

@max-sixty max-sixty removed the bug Invalid compiler output or panic label Mar 7, 2024
@aljazerzen
Copy link
Member

The problem here is that your query is parsed as:

from pets | (take - 10)

This is obviously wrong, you cannot substract a number from a function.

Long-term solution is to provide a type error. Short term solution is to make a special case somewhere.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants