malloydata / malloy

Malloy is an experimental language for describing data relationships and transformations.
http://www.malloydata.dev
MIT License
1.92k stars 75 forks source link

having: should use a merged scope #173

Open mtoy-googly-moogly opened 2 years ago

mtoy-googly-moogly commented 2 years ago

having: statements should process expressions in a scope which includes measures from the input structdef AND any aggregate fields in the output structdef

for example ...

query: flights -> {
  group_by: carrier
  aggregate: [
    aircraft_models_avg_seats is aircraft.aircraft_models.seats.avg()
  ]
  having: aircraft_models_avg_seats > 10
}

Some pre-design thinking is in #405

anikaks commented 2 years ago

Encountered some funny business with having today; using having anywhere in my query containing a nest produced pretty off results. I assume this is the same issue?