probcomp / bayeslite

BayesDB on SQLite. A Bayesian database table for querying the probable implications of data as easily as SQL databases query the data itself.
http://probcomp.csail.mit.edu/software/bayesdb
Apache License 2.0
922 stars 64 forks source link

expand subquery column lists first before macro expansion #530

Closed riastradh-probcomp closed 7 years ago

riastradh-probcomp commented 7 years ago

Currently we expand subquery column lists -- SELECT t.(SELECT ...) -- at the same time we format the SQL output. The ad hoc macro expansion for SIMULATE <compound expression> FROM MODELS OF p that I added last week happens before that, but for SIMULATE t.(<subquery>) FROM MODELS OF p to work, we need the macro expander to know the list of variables produced by first. So the easiest way to accomplish that will be to do things in three stages:

  1. Expand subquery column lists.
  2. Expand compound expression SIMULATE into SELECT of primitive expression SIMULATE.
  3. Generate SQL.
riastradh-probcomp commented 7 years ago

Done in f7647324018d9dfe380d5caa62bd08c1ee5c5895.