zlacker

[parent] [thread] 11 comments
1. 10000t+(OP)[view] [source] 2024-08-24 17:51:52
The pipeline syntax as presented is nicer than the status quo, but I'd prefer a syntax that models query execution as a directed graph of operations. Doing so would not only make some of the more complex SQL query constructs much more straightforward to represent:

* Joins can be modelled as a "cross-referencing" operation that consume two (or more) data streams and produce a single data stream

* CTEs can be modelled as producing multiple data streams

* Recursive CTEs can be modelled as cycles in the execution graph

replies(2): >>almost+48 >>aranke+Oh
2. almost+48[view] [source] 2024-08-24 18:50:15
>>10000t+(OP)
> a directed graph of operations

What syntax do you know that can represent a dag in text?

replies(3): >>RyanHa+Ek >>cha42+Gk >>mr_toa+nmc
3. aranke+Oh[view] [source] 2024-08-24 20:05:17
>>10000t+(OP)
Check out Substrait, it sounds like what you’re describing.
◧◩
4. RyanHa+Ek[view] [source] [discussion] 2024-08-24 20:30:17
>>almost+48
A = select * from tbla

B = select * from tblb

C = select * from A join B

replies(2): >>wtetzn+Wn >>almost+dt
◧◩
5. cha42+Gk[view] [source] [discussion] 2024-08-24 20:30:55
>>almost+48
Any syntax with a let operator to name stuff or a lambda abstraction.
replies(1): >>almost+Us
◧◩◪
6. wtetzn+Wn[view] [source] [discussion] 2024-08-24 20:59:23
>>RyanHa+Ek
I guess CTEs already provide that (even if they're a bit clunky).

    WITH a AS (select * from tbla),
    b AS (select * from tblb)
    select * from a join b
◧◩◪
7. almost+Us[view] [source] [discussion] 2024-08-24 21:36:53
>>cha42+Gk
That only gives you trees not DAGs - you can't do fan-in (there's no way to "share" let bound names).
replies(1): >>mathnm+W9f
◧◩◪
8. almost+dt[view] [source] [discussion] 2024-08-24 21:38:22
>>RyanHa+Ek
Yes we already have that, it's called `async def`.
◧◩
9. mr_toa+nmc[view] [source] [discussion] 2024-08-29 04:58:35
>>almost+48
Something like the DOT language used in GraphViz

https://graphviz.org/doc/info/lang.html

replies(1): >>almost+Xrc
◧◩◪
10. almost+Xrc[view] [source] [discussion] 2024-08-29 06:07:06
>>mr_toa+nmc
Yes DOT (and the other UML whatever languages) are absolutely the only extant examples that make an attempt. But again, if you look at DOT you'll see it doesn't actually do anything syntactically - it just has syntax for edge lists.
◧◩◪◨
11. mathnm+W9f[view] [source] [discussion] 2024-08-30 06:40:33
>>almost+Us
Isn't this fan-in?

let A = select * from tbla

let B = select * from tblb

let C = select * from A join B

replies(1): >>almost+weh
◧◩◪◨⬒
12. almost+weh[view] [source] [discussion] 2024-08-31 02:36:16
>>mathnm+W9f
Think about what tbla and tblb can be - hint they can only be globals (ie actual tables)
[go to top]