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

Declarations don't work when nesting #652

Open
lloydtabb opened this issue Jul 27, 2022 · 2 comments · May be fixed by #699
Open

Declarations don't work when nesting #652

lloydtabb opened this issue Jul 27, 2022 · 2 comments · May be fixed by #699
Assignees
Labels
bug Something isn't working language An issue in the Malloy language

Comments

@lloydtabb
Copy link
Collaborator

The following code yields an internal error path not found. Not quite sure how to solve it.

image

source: s is table('malloytest.state_facts') + {

  query: a is {
    declare: total_births is births.sum()
    group_by: popular_name
    aggregate: total_births
  }

  query: b is {
    group_by: state
    nest: a
  }
}
@mtoy-googly-moogly
Copy link
Collaborator

mtoy-googly-moogly commented Jul 27, 2022

OK, writing down what is going on so I don't forget

  1. Declare makes a query refine it's source
  2. Nesting a query somehow makes that refinement not work
  3. If two nested queries "declare" the same name, those names need to remain local to each nested query, so the refinement of the source needs to either be a graph, or needs to have some mapping. I think this means how "declare" works needs to change

@mtoy-googly-moogly mtoy-googly-moogly linked a pull request Aug 3, 2022 that will close this issue
@mtoy-googly-moogly
Copy link
Collaborator

mtoy-googly-moogly commented Aug 5, 2022

Ok @lloydtabb throwing this to you.

I suspect you need to look at QueryQuery.makeQuery where extendSource: is only consulted on the first segment of a pipeline

There is a branch and a PR, the only thing on that branch is the test.

@anikaks anikaks added bug Something isn't working language An issue in the Malloy language labels Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working language An issue in the Malloy language
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants