-
Notifications
You must be signed in to change notification settings - Fork 208
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
Resolve opaqueness of idents #1535
Comments
@aljazerzen as discussed |
We discussed this on the dev call and I said I'd think more about the tradeoffs. I think this issue demonstrates some weaknesses is our current name handling. We have a tri-lemma; we want:
The trilemma is that we can't avoid splitting I think the current state is quite bad, and it's worth adjusting & investing to fix it, even if it means breaking things. The only option I can think of is that we give up the "To not need to manage database schema hierarchy in PRQL". So, we would:
As long as it's do-able, I think this would be an excellent result — a simpler model, with fewer surprises, and much better for things like URLs. The main internal change is that Namespaces would need to become hierarchical. Any thoughts? We can discuss when |
I'm not sure this was correct prior; at least it didn't pass these tests, and I couldn't work out why it started with `!`. This is part of the refactoring in PRQL#1535
Part of PRQL#1535, this changes our Idents in PL from `$namespace.$name` to an arbitrary hierachy. It's full of `.clone()` & `.into()` -- I've been doing this by replacing one definition and then adding lots of `.into()` untils it passes (not the most conceptual work!). Doing it incrementally at least means I can't end up in a quagmire of not knowing why the new version doesn't work; it's easy to revert to the last known good state. We can do another pass to improve the rust / reduce allocations. The plan here would be to: - replace any other usages in the compilation prior to the ident being resolved. Once it's resolved, it doesn't necessarily need a full hierarchy. Possibly we can remove the old `Ident` / rename the new one to `Ident`. - adjust how the resolution works so we can have arbitrary hierarchies of schema (`a.b.c`). Still some work to think about how this should work (some initial comments in PRQL#1535) - make backticks fully opaque, so PRQL#1535 works -- then using parquet files will be easy, we won't need to quote schemas, the semantics will be simple & consistent
I'm closing #2305 but pasting the next steps from that here, as those are still required:
|
Trying to understand these as part of PRQL#1535; GPT-4 helped with some tests. More to come
Edit: Renamed from "Resolve idents based on type"; new proposal below. Original issue follows:
Continuing on from #1516
Currently backticks are required in:
...which compiles to
That's because the resolver will try to resolve...
...as a namespace
schema
and a column nametable
, which then breaks.I think ideally — we would instead resolve the argument based on its type:
from
&join
would resolve to namespacesselect
&derive
etc would resolve to columnsThen:
from schema.table
would be parsed as a single namespaceschema.table
, not a namespaceschema
and columntable
.select table.column
would still be parsed as a namespacetable
& columncolumn
, because that's typed as a columnAnd then:
.
, clearing up feat: Parse idents with*
as quoted #1516from schema.table
, notfrom `schema.table`
and produce the correct thingThe text was updated successfully, but these errors were encountered: