Interesting paper from Google on pipe syntax on SQL (2024)

(1)By Sebastian LaVine (smlavine) on 2024-08-24 17:24:49[link][source]

(2)By Bo Lindbergh (_blgl_) on 2024-08-25 00:20:46in reply to 1[link][source]

Deliberately not improving insert, update, and delete is disappointing.

(3)By Dave Mausner (dmausner) on 2024-08-25 13:55:52in reply to 1[link][source]

It's an interesting paper. Serious academic papers don't describe themselves as "great!", but consider the source.I observe that programmers have always understood that compilers convert the syntax language into an internal semantic language for execution. This does not invalidate their solution.The problem of successive table result processing syntax can be reduced by the use of cascading (that is, nested) views which pass all the needed column expressions down the line. This reduces syntax complexity, too, letting sqlite do the ugly work.That's what computers do. I don't feel sorry for compilers.

(4)By Dave Mausner (dmausner) on 2024-08-25 14:04:43in reply to 3[link][source]

Commenting upon myself, I readily admit that it's kewl to take a table result and pipe it to PIVOT, then down the lane.

(5)By Adrian Ho (lexfiend) on 2024-08-25 16:32:55in reply to 1[link][source]

I think the main selling point of pipe syntax is improved ability to reason about complex queries. Having semantic evaluation order match syntactic order is already a significant improvement, and I imagine the resulting dataflow-like mental paradigm sits better with most folks.

(6)By Richard Hipp (drh) on 2024-08-25 20:11:58in reply to 1[link][source]

I do not like the pipe operator (|>). Apparently, I am not the firstto offer this criticism. The authors list 11 reasons why they think thepipe operator is useful in section 4.1.4. I remain unconvinced.

(7)By Alex Garcia (alexgarciaxyz) on 2024-08-26 00:33:35in reply to 6[link][source]

I also don't like the pipe syntax very much, but I think there is some value in an optional re-order of SELECT and FROM clauses. Like having the SELECT clause come after FROM, like:

FROM usersSELECT first_name, last_nameWHERE id = 123;

Or even have the SELECT be entirely optional, like FROM users WHERE id = 123 (where SELECT * becomes the default).

I think this paper and other "compile-to-SQL" languages like PRQL and Logica and Malloy offer some syntax sugar that really don't have sense in pre-existing SQL databases like SQLite. But all of them have a "FROM-first" mentality, which fits a lot of developer's mental models of how SQL queries are ran.

DuckDB offers FROM-first in their SQL, though not sure if other SQL databases also do this.

(8)By Richard Hipp (drh) on 2024-08-26 02:58:33in reply to 7[link][source]

Yes, Figures 1 and 2 on page 2 nicely illustrate how FROM-first bettermatches the semantics of the statement. It also illustrates how WHEREcan serve as a WHERE or a HAVING depending on whether it occurs beforeor after the AGGREGATE step, respectively, which is nice. Section 5.3points out that FROM-first queries have the "prefix property" thatany prefix of the query is also a valid query. This allows you to testout your query incrementally.

(9)By Richard Hipp (drh) on 2024-08-26 14:26:10in reply to 1[source]

For a limited time only, there is a bootleg https://sqlite.org/fiddleon-line that supports some of the proposed "pipe" syntax outlined inthe Google paper. This is but a quick prototype. You can expect to find bugs.

Differences from the syntax described in the paper:

  • The "|>" operator is optional, except before the AS pipe operator. Before AS, you have to include |> to avoid a syntax ambiguity. If (like me) you dislike the |> operator, you can say "VIEW <name>" instead of "AS <name>" to accomplish the same thing and the |> operator is not required before VIEW.

  • The following pipe operators are not implemented: EXTEND, SET, DROP, CALL, TABLESAMPLE, PIVOT, UNPIVOT.

(10)By Domingo (mingodad) on 2024-08-26 15:50:21in reply to 9[link][source]

I've just added the grammar changes to allow a limited usage of PIPE operator that Richard did here https://mingodad.github.io/parsertl-playground/playground/ (select "SQLite3 PIPES modified parser (partially working)" from "Examples" then click `Parse` to see a parse tree for the contents in "Input source").Also there there is the zetasql grammar with PIPES (select "ZetaSQL parser (be patient)(partially working)" from "Examples").You can edit the grammar and click "Parse" to see the results, it's an in browser YACC/LEX interpreter via wasm.

(13)By anonymous on 2024-08-26 21:27:34in reply to 9[link][source]

Thanks for the fiddle.

notes while experimenting:

  1. While exploring the "pipe" syntax it might be useful to have some sort less verbose CAST() so that when enforcing affinity/datatypes (i.e. when expressions are in the pipes) the CAST() doesn't make reading the query more difficult. Because other SQL implementations don't use SQLite's flexible datatypes/affinity the Google folks won't necessarily raise the awkward CAST() in their paper.

  2. For EXTEND, "select *, cast([expr] as [type]) as [column]" was used.

  3. For SET, all columns are individually specified (except for the "SET" column), and the EXTEND substitution was used.

  4. For DROP, again, all columns individually specified except for the "DROP" column.

  5. There may be some push through optimisations (as opposed to the push down optimisations) such as dropping columns that end up not being used.

  6. operational note (operator error): When writing ad hoc SQL, missing a ; between statements will take some getting used to. For example several statements in the fiddle, perhaps meant to run individually will now pipe to each other rather than give an error. For example:

FROM (select 2 as id) /* without ; */select 1 as id

All in all, IMAO (In My Anonymous Opinion) piping seems to worth a look.

(14)By Richard Hipp (drh) on 2024-08-26 22:58:53in reply to 13[link][source]

Worth a look, maybe, but not worth landing on trunk.

My goal is to keep SQLite relevant and viable through the year 2050.That's a long time from now. If I knew that standard SQL was not goingto change any between now and then, I'd go ahead and make non-standardextensions that allowed for FROM-clause-first queries, as that seemslike a useful extension. The problem is that standard SQL will notremain static. Probably some future version of "standard SQL" will supportsome kind of FROM-clause-first query format. I need to ensure that whateverSQLite supports will be compatible with the standard, whenever it drops.And the only way to do that is to support nothing until after the standardappears.

When will that happen? A month? A year? Ten years? Who knows.

I'll probably take my cue from PostgreSQL.If PostgreSQL adds support for FROM-clause-first queries, then I'll dothe same with SQLite, copying the PostgreSQL syntax. Until then, I'mafraid you are stuck with only traditional SELECT-first queries in SQLite.

I'm not overly impressed with the Google pipe syntax. They talk a goodgame in the paper. They sound really convincing. But once I startedactually looking for use cases and messing with it, I, for one, lostinterest in their design. I have hundreds, perhaps thousands, of queriesin the Fossil implementation whichI went trolling through, and I didn't find any that would be improvedby Google pipe syntax over just having FROM-first queries. Maybe Googleis more focused on analytical queries against big data. Maybe the pipe syntaxworks better for really gnarly analytical queries. It doesn't seem to helpfor the kinds of queries I do in Fossil using SQLite, though, at least notthat I've seen.

Doing the prototype implementation and working through the issues was auseful exercise. I now know that SQLite can be easily converted tosupport Google pipe syntax and/or FORM-first queries, should the needarise, simply by adding a few new production rules to the LALR(1) grammar,and with no changes to the query planner/optimize. But the present needis insufficient to overcome the future incompatibility risk.

(11)By Stéphane Aulery (saulery) on 2024-08-26 15:59:06in reply to 1[link][source]

If you want to explore a better query language there is the Third Manifesto and Tutorial D by Chris Date.

(12)By anonymous on 2024-08-26 16:06:22in reply to 11[link][source]

I thought about mentioning that one, since it was discussed in the ML a long time ago. Someone was doing a modern take on Tutorial D, if I remember right. But I couldn't find the reference in searching the forum, so I gave up... Perhaps because it's too old, pre-forum, and was on the ML only.

Interesting paper from Google on pipe syntax on SQL (2024)
Top Articles
Matcha Contains Significantly More Caffeine Than Green Tea… but Is It *Too* Much?
Chia Seeds: Daily Consumption Guide | - Times of India
Wal-Mart 2516 Directory
Zavvi Discount Code → 55% Off in September 2024
Transfer and Pay with Wells Fargo Online®
15 Cloud Tattoo Meaning Symbolism- Reflecting Change and Transience
Cpt 90677 Reimbursem*nt 2023
What Was D-Day Weegy
Chukchansi Webcam
Stellaris Mid Game
1v1 lol unblocked Game- Play Unblocked Game Online for Free!
Espn Masters Leaderboard
Busted Newspaper Hart County Ky
Folsom Gulch Covid
Exquisitely Stuffed Terraria
Violent Night Showtimes Near The Riviera Cinema
Gopher Hockey Forum
Osrs Mahogany Homes Calc
Comenity Pay Cp
Ofw Pinoy Channel Su
Txu Cash Back Loyalty Card Balance
Koal Bargain Bin
Red Lobster cleared to exit bankruptcy under new owner Fortress
Hdtoday.comtv
Moss Adams Client Portal
Morgan Plus Four 2024 review
Beaver Dam Locations Ark Lost Island
Loterie Midi 30 Aujourd'hui
New Homes in Waterleigh | Winter Garden, FL | D.R. Horton
Drive Mad Yandex
Bolly2Tolly Sale
Barber Gym Quantico Hours
Stanley Steemer Medford Oregon
Kino am Raschplatz - Vorschau
Jasminx Fansly
Xdefiant turn off crossplay ps5 cмотреть на RuClips.ru
Solve x^2+2x-24=0 | Microsoft Math Solver
O2 eSIM guide | Download your eSIM | The Drop
Dvax Message Board
Milepslit Ga
Colonial Interceptor
6173770487
Dollar Tree Aktie (DLTR) • US2567461080
How To Get Mini Tusks In Blox Fruits
ARK Fjordur: Ultimate Resource Guide | Where to Find All Materials - Games Fuze
Lost Pizza Nutrition
Tacoma Craigslist Free
Ap Chem 2022 Frq Scoring Guidelines
Hit Entertainment Wiki
R Warhammer Competitive
my Control Vitality Female Support Complex (10 ml)
Latest Posts
Article information

Author: Aracelis Kilback

Last Updated:

Views: 5792

Rating: 4.3 / 5 (44 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Aracelis Kilback

Birthday: 1994-11-22

Address: Apt. 895 30151 Green Plain, Lake Mariela, RI 98141

Phone: +5992291857476

Job: Legal Officer

Hobby: LARPing, role-playing games, Slacklining, Reading, Inline skating, Brazilian jiu-jitsu, Dance

Introduction: My name is Aracelis Kilback, I am a nice, gentle, agreeable, joyous, attractive, combative, gifted person who loves writing and wants to share my knowledge and understanding with you.