Live data from Hacker News

Google's new pipe syntax in SQL

simonwillison.net

121–130 of 192 posts

Re: Google's new pipe syntax in SQL

#121

I didn't see this the first time: GROUP AND ORDER BY component_id DESC; Is this kind of syntax combining grouping and ordering really necessary in addition the pipe operator? My advice would be to add the pipe operator and not get fancy adding other syntax to SQL as well.

It could be a custom zetasql extension leaked into the paper.

Re: Google's new pipe syntax in SQL

#123
post #68

Earlier quoted context omitted.

Why shouldn’t I read research papers on my phone? That’s where I read almost everything else.

Even when reading on the phone, I do not understand the complaint against the two-column format. The one-column format is fine on a large monitor, but on a small phone I prefer narrower columns, because a wide column would either make the text too small or it would require horizontal panning while reading. So I consider the two-column format as better for phones, not worse.

One of the most complex and battle-tested open source projects is essentially a rendering engine for semantic text that has supported reflowing text to fit the screen for decades. And now you’re seriously considering having to zoom in on a column, then scrolling all the way back up and right to the next column, then down to the footnotes at the bottom, then to a random figure, to be a solution?

Re: Google's new pipe syntax in SQL

#124

Richard Hipp, creator of SQLite, has implemented this in an experimental branch: https://sqlite.org/forum/forumpost/5f218012b6e1a9db Worth reading the thread, there are some good insights. It looks like he will be waiting on Postgres to take the initiative on implementing this before it makes it into a release.

It's funny how he addresses the new syntax as "from-clause-first". Like a very minor change with a low value.

Re: Google's new pipe syntax in SQL

#125

For the sake of God, please fucking stop inventing new pipe languages. LINQ: exists Splunk query language: exists KQL: exists MongoDB query language: exists PRQL: exists

SQL parsers: exists.

The paper clearly describes the goal: add a pipe syntax into existing systems with minor changes and be compatible with existing SQL queries.

BTW: LINQ is an AST transformer not a language per se tied to a particular platform. None of existing DBs allows to use it directly.

Re: Google's new pipe syntax in SQL

#126
post #124

Richard Hipp, creator of SQLite, has implemented this in an experimental branch: https://sqlite.org/forum/forumpost/5f218012b6e1a9db Worth reading the thread, there are some good insights. It looks like he will be waiting on Postgres to take the initiative on implementing this before it makes it into a release.

It's funny how he addresses the new syntax as "from-clause-first". Like a very minor change with a low value.

I think that's important, because a lot of concepts are presented as prohibitively complicated; for example, functional programming makes sense in my head, but if you present it as lambda calculus and write it in concise form with new operators, you lost me.

Re: Google's new pipe syntax in SQL

#127
Looking at the first example from PDF:

    FROM customer
    |> LEFT OUTER JOIN orders ON c_custkey = o_custkey
    AND o_comment NOT LIKE '%unusual%packages%'
    |> AGGREGATE COUNT(o_orderkey) c_count
    GROUP BY c_custkey
    |> AGGREGATE COUNT(*) AS custdist
    GROUP BY c_count
    |> ORDER BY custdist DESC, c_count DESC;
You could do something similar with Ryelang's spreadsheet datatype:

    customers: load\csv %customers.csv
    orders: load\csv %orders.csv

    orders .where-not-contains 'o_comment "unusual packages" 
    |left-join customers 'o_custkey 'c_custkey
    |group-by 'c_custkey { 'c_custkey count }
    |group-by 'c_custkey_count { 'c_custkey_count count }
    |order-by 'c_custkey_count_count 'descending
Looking at this, maybe we should add an option to name the new aggregate column (now they get named automatically) in group-by function because c_custkey_count_count is not that elegant for example.

Re: Google's new pipe syntax in SQL

#128

Earlier quoted context omitted.

> Kinda looks like a half-assed version of what PRQL does. Like, if we’re going to have nonstandard sql, let’s just fix a whole bunch of things, not just one or two? To be honest, this feels exactly like the kind of mistake that IPv6 made. It wasn't just "let's extend the IPv4 address space and provide an upgrade path that's as incremental as possible", it was "IPv4 has all these problems, lets solve the address spac…

You can't "just" extend the IPv4 address space while keeping the compatibility.

Extending src/dst in current IPv4 protocol headers is much easier than adopting a completely new suite.

Re: Google's new pipe syntax in SQL

#129
There's honeysql library in Clojure, where you define queries as maps, which are then rendered to SQL strings:

    {:select [:name :age]
     :from {:people :p}
     :where [:> :age 10]}
Since maps are unordered, this is equivalent to

    {:from {:people :p}
     :select [:name :age]
     :where [:> :age 10]}
and also

    {:where [:> :age 10]
     :select [:name :age]
     :from {:people :p}}


These can all be rendered to 'SELECT... FROM' or 'FROM .. SELECT'.

Queries as data structures are very versatile, since you can use the language constructs to compose them.

Queries as strings (FROM-first or not) are still strings which are hard to compose without breaking the syntax.

Re: Google's new pipe syntax in SQL

#130
post #123

Earlier quoted context omitted.

Even when reading on the phone, I do not understand the complaint against the two-column format. The one-column format is fine on a large monitor, but on a small phone I prefer narrower columns, because a wide column would either make the text too small or it would require horizontal panning while reading. So I consider the two-column format as better for phones, not worse.

One of the most complex and battle-tested open source projects is essentially a rendering engine for semantic text that has supported reflowing text to fit the screen for decades. And now you’re seriously considering having to zoom in on a column, then scrolling all the way back up and right to the next column, then down to the footnotes at the bottom, then to a random figure, to be a solution?

Yes, I strongly prefer reading PDF documents with fixed layout instead of HTML or any other formats with reflowing text, including on small phone screens.

I frequently read documents with many thousands of pages, which also contain many figures and tables.

A variable layout, at least for me, makes the browsing and the search through such documents much more difficult.

I have never ever seen any advantage in having the text reflow to match whatever window happens to be temporarily used to display the text, except for ephemeral messages that I will never read again.

For anything that I will read multiple times, I want the text to retain the same layout, regardless of what device or window happens to display it. If necessary, I see no problem in adjusting the window to fit the text, instead of allowing changes in the text, which would interfere with my ability of remembering it from the previous readings.

I really hate those who fail to provide their technical documentation as PDF documents, being content to just have some Web pages with it.

Post reply on HN