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

head/tail/top error messages should speak of constant expressions #5297

Open
philrz opened this issue Sep 22, 2024 · 0 comments
Open

head/tail/top error messages should speak of constant expressions #5297

philrz opened this issue Sep 22, 2024 · 0 comments

Comments

@philrz
Copy link
Contributor

philrz commented Sep 22, 2024

tl;dr

This error message speaks of an expression/integer, but it actually takes a compile-time constant expression that evaluates to a positive integer, which is more limiting.

$ zq 'yield {x:1} | head x'
zq: expression value must be an integer value: error("missing") at line 1, column 20:
yield {x:1} | head x
                   ~

Details

Repro is with Zed commit c1da204.

This topic was surfaced in a recent community Slack thread. Similar error messages show up with head, tail, and top.

$ zq -version
Version: v1.18.0

$ zq 'yield {x:1} | head x'
zq: expression value must be an integer value: error("missing") at line 1, column 20:
yield {x:1} | head x
                   ~

$ zq 'yield {x:1} | tail x'
zq: expression value must be an integer value: error("missing") at line 1, column 20:
yield {x:1} | tail x
                   ~

$ zq 'yield {x:1} | top x x'
zq: limit argument must be an integer at line 1, column 19:
yield {x:1} | top x x
                  ~

In recent PRs #5276 and #5296 we're making sure user-facing docs emphasize that each of these parameters should be a "compile-time constant expression that evaluates to a positive integer". However, since some users may not have read the docs, we could stand to improve the error message.

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

1 participant