Google's SQL dialect added a `|>` pipe operator

From here: Work with pipe query syntax  |  BigQuery  |  Google Cloud
HN: SQL pipe syntax available in public preview in BigQuery | Hacker News

Example usage:

-- Filter items with no sales.
FROM Produce
|> WHERE sales > 0;

-- Compute total sales by item.
FROM Produce
|> WHERE sales > 0
|> AGGREGATE SUM(sales) AS total_sales, COUNT(*) AS num_sales
   GROUP BY item;

Thought it could be worth mentioning, as it shows how Elixir proceeds to influence other languages.

3 Likes

Brings to mind PRQL, which is a much larger change to query authoring.

1 Like

To be “that guy,” Elixir took from |> from F#. Though perhaps someone will come along and tell me where F# took it from :upside_down_face:

4 Likes

For me, |> belongs only to Elixir. I will not consider working with any wannabes :slightly_smiling_face:

Haha, I agree. JavaScript might be getting it and I was watching a video on it. The guy kept calling it “the F# operator” and it was annoying me :sweat_smile: I didn’t lose any sleep over it, though :upside_down_face:

1 Like
5 Likes

And the prophecy is fulfilled!

1 Like

Really enjoyed that article on archeological semiotics and how it dropped a bunch of lore i.e. the original email thread. Well worth the read and really humanizes how the pipeline symbol came to be!

To summarize, |> was carried over from Isabelle/ML…

Now if we continue digging, The Early History of F#, also written by Don Syme aka the creator of F# unsurprisingly mentions the “obvious semiotic inspiration from UNIX pipes.” So this naturally begs the question of how the UNIX pipe operator came to be? Well here’s another fun tidbit of archeological semiotics …

Though Mahoney’s interview suggests that the original symbol for pipes was “> ,” in the 1994 book, “A Quarter Century of Unix,” McIlroy remembers when Thompson decided the symbol for pipes should instead be “|.” Thompson made the change “for a talk in London, because he couldn’t bear to reveal my ugly syntax.”
source: Pipe: How the System Call That Ties Unix Together Came About

So perhaps it went from > :icon_arrow: | :icon_arrow: |> :exploding_head:

5 Likes