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

Making variables available after "from eval(...)" #5493

Open
philrz opened this issue Nov 20, 2024 · 0 comments
Open

Making variables available after "from eval(...)" #5493

philrz opened this issue Nov 20, 2024 · 0 comments

Comments

@philrz
Copy link
Contributor

philrz commented Nov 20, 2024

tl;dr

Similar to how we make variables available in lateral subqueries via over ... with <var>=<expr>, it seems users might benefit from being able to do from eval (...) with <var>=<expr>.

Details

At the time this issue is being opened, super is at commit 87ab6b7.

Consider the following query, which is a simplification of something like the example query currently in the super repo README.

$ super -version
Version: v1.18.0-160-g87ab6b72

$ echo '{user:"mccanne"} {user:"philrz"}' |
   super -c 'from eval(f"https://api.github.com/users/{user}") | yield {user:user,created_at:time(created_at)}' -
{user:error("missing"),created_at:2012-08-07T18:52:36Z}
{user:error("missing"),created_at:2013-11-13T23:32:04Z}

As a naive user, I assumed that the user values upstream of my from could still be available post-from, but instead I've got only the new dataflow resulting from the from eval(...).

To get around this, I could use an approach like the one in the super repo README of using fork to split off the original dataflow and then later using join to somehow combine it back with the data that came out of the from eval(...). However, fork and join are more advanced language features, so that got me to thinking that users might appreciate a more direct way to handle this.

Following existing patterns in the language, the variables in over ... with ... came to mind, e.g., we might offer something like:

$ echo '{user:"mccanne"} {user:"philrz"}' |
   super -c 'from eval(f"https://api.github.com/users/{user}") with orig_user=user | yield {user:orig_user,created_at:time(created_at)}' -
{user:"mccanne",created_at:2012-08-07T18:52:36Z}
{user:"philrz",created_at:2013-11-13T23:32:04Z}
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

No branches or pull requests

1 participant