@@ -20,27 +20,16 @@ and the SuperSQL compiler often optimizes a query into an implementation
2020different from the [ dataflow] ( https://en.wikipedia.org/wiki/Dataflow ) implied by the pipeline to achieve the
2121same semantics with better performance.
2222
23- While SuperSQL at its core is a pipe-oriented language, it is also
24- [ backward compatible] ( ../intro.md#supersql ) with relational SQL in that any
25- arbitrarily complex SQL query may appear as a single pipe operator
26- anywhere in a SuperSQL pipe query.
27-
28- In other words, a single pipe operator that happens to be a standalone SQL query
29- is also a SuperSQL pipe query.
30- For example, these are all valid SuperSQL queries:
31- ```
32- SELECT 'hello, world'
33- SELECT * FROM table
34- SELECT * FROM f1.json JOIN f2.json ON f1.id=f2.id
35- SELECT watchers FROM https://api.github.com/repos/brimdata/super
36- ```
37-
38- ## Interactive UX
23+ ## Friendly Syntax
3924
40- To support an interactive pattern of usage, SuperSQL includes
41- [ search] ( operators/search.md ) syntax
42- reminiscent of Web or email keyword search along with
43- [ _ operator shortcuts_ ] ( operators/intro.md#shortcuts ) .
25+ In addition to its user-friendly pipe syntax,
26+ SuperSQL embraces two key design patterns that simplify
27+ query editing for interactive usage:
28+ * [ shortcuts] ( operators/intro.md#shortcuts ) that reduce
29+ typing overhead and provide a concise syntax for common query patterns, and
30+ * [ search] ( operators/search.md )
31+ reminiscent of Web or email keyword search, which is otherwise hard
32+ to carry out with traditional SQL syntax.
4433
4534With shortcuts, verbose queries can be typed in a shorthand facilitating
4635rapid data exploration. For example, the query
@@ -49,7 +38,10 @@ SELECT count(), key
4938FROM source
5039GROUP BY key
5140```
52- can be simplified as ` from source | count() by key ` .
41+ can be simplified to
42+ ```
43+ from source | count() by key
44+ ```
5345
5446With search, all of the string fields in a value can easily be searched for
5547patterns, e.g., this query
@@ -60,6 +52,23 @@ from source
6052searches for the strings "example.com" and "urgent" in all of the string values in
6153the input and also includes a numeric comparison regarding the field ` message_length ` .
6254
55+ ## SQL Compatibility
56+
57+ While SuperSQL at its core is a pipe-oriented language, it is also
58+ [ backward compatible] ( sql/intro.md ) with relational SQL in that any
59+ arbitrarily complex SQL query may appear as a single pipe operator
60+ anywhere in a SuperSQL pipe query.
61+
62+ In other words, a single pipe operator that happens to be a standalone SQL query
63+ is also a SuperSQL pipe query.
64+ For example, these are all valid SuperSQL queries:
65+ ```
66+ SELECT 'hello, world'
67+ SELECT * FROM table
68+ SELECT * FROM f1.json JOIN f2.json ON f1.id=f2.id
69+ SELECT watchers FROM https://api.github.com/repos/brimdata/super
70+ ```
71+
6372## Pipe Queries
6473
6574The entities that transform data within a SuperSQL pipeline are called
109118
110119## Pipe Sources
111120
112- Like SQL, input data for a query is typically sourced with the
121+ Like SQL, input data for a pipe query is typically sourced with the
113122[ from] ( operators/from.md ) operator.
114123
115124When ` from ` is not present, the file arguments to the
@@ -331,12 +340,12 @@ The array subquery produces an array value so it is often desirable to
331340[ unnest] ( operators/unnest.md ) this array with respect to the outer
332341values as in
333342```
334- from f1.json | unnest {outer:this,inner:[from f2.json | ...]} into ( <scope > )
343+ from f1.json | unnest {outer:this,inner:[from f2.json | ...]} into ( <query > )
335344```
336- where ` <scope > ` can be an arbitrary pipe query that processes each
345+ where ` <query > ` is an arbitrary pipe query that processes each
337346collection of unnested values separately as a unit for each outer value.
338- The ` into ( <scope > ) ` body is an optional component of ` unnest ` , and if absent,
339- the unnested collection boundaries are ignored and all of the unnested data is output.
347+ The ` into ( <query > ) ` body is an optional component of ` unnest ` , and if absent,
348+ the unnested collection boundaries are ignored and all of the unnested data is output as a combined sequence .
340349
341350With the ` unnest ` operator, we can now consider how a [ correlated subquery] ( https://en.wikipedia.org/wiki/Correlated_subquery ) from
342351SQL can be implemented purely as a pipe query with pipe scoping.
@@ -363,7 +372,7 @@ giving the same result
363372{s:21}
364373```
365374
366- ## Strong Typing
375+ ## Type Checking
367376
368377Data in SuperSQL is always strongly typed.
369378
0 commit comments