SQL pipe syntax
Write SQL top to bottom with the |> operator, in the order the query actually runs.
Step 2 · Spark internals · Gold · Spark 4, lesson 4 of 5
On this page
Read first: Catalyst and physical plans (skip if you know it)
In plain words first
A recipe lists its steps in order: chop, fry, season, serve. Classic SQL is like a recipe that starts with "serve" and lists the chopping at the end.
Pipe syntax writes the query like a recipe: FROM first, then each step after |>, in the order Spark runs them.
Unlock the full lesson
You have read the free part. The rest of this advanced lesson:
- Why a new syntax
- Side by side
- Operators
- Why engineers like it
- Try it yourself
- Common mistakes
- Key takeaways
- Interview prep with 3 follow-up questions
- Check yourself: 3 questions
Unlock it with the Complete pass (every advanced problem and lesson) or on its own.
Practise this
Interview problems on spark performance, graded on hidden tests
Keep going
Up next · Spark 4 · lesson 5 of 5 · 6 min readPython Data Source API
Write custom batch and streaming readers and writers for Spark in pure Python.
Related lessons
Spark internals · 6 min read
Catalyst and physical plansPySpark functions · 4 min read
groupBy + aggSpark internals · 5 min read
ANSI mode by default
Catalyst and physical plansPySpark functions · 4 min read
groupBy + aggSpark internals · 5 min read
ANSI mode by default
Previous: The VARIANT type
Primary sources: Spark SQL reference