Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions book/src/getting-started/hello-world.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
## Hello World
# Hello World

To test out the installed `super` binary, try running Hello World!
To test out the [installed](install.md) `super` binary, try running these
"Hello World" examples.

First, here is a Unix-y version. Copy this to your shell and run it:
## Stdin to Stdout

First, here is a Unix-y version that simply reads from standard input.
Copy this one liner to your shell and run it:
```
echo '"hello, world"' | super -
```
Expand All @@ -12,16 +16,18 @@ You should get:
```
In this simple case,
there is no query argument specified for `super` (i.e., no `-c` argument), which causes
`super` to presume an implied [`from` operator](../super-sql/operators/from.md).
`super` to presume an implied [from](../super-sql/operators/from.md) operator.
This `from` operator scans each of the command-line arguments
interpreted as file paths or URLs (or `-` for standard input).

In this case, the input is read from the implied operator, no further query
is applied, and the results are emitted to standard output.
This results is the string value `"hello, world"`,
This results in the string value `"hello, world"`,
serialized in the default [SUP format](../formats/sup.md),
which is simply the string literal itself.

## SQL Version

A SQL version of Hello World is:
```
super -c "SELECT 'hello, world' as Message"
Expand All @@ -30,9 +36,9 @@ which outputs
```
{Message:"hello, world"}
```
This is single row in a table with one column called `Message` of type `string`.
This is a single row in a table with one column called `Message` of type `string`.

### SuperDB Database
## SuperDB Database

The top-level `super` command runs without any underlying persistent database,
but you can also run Hello World with a database.
Expand All @@ -54,9 +60,9 @@ and you should see
{Message:"hello, world"}
```

### SuperDB Service
## SuperDB Service

Now that you have a database in the `./scratch` directory, you could also
With your database in the `./scratch` directory, you can also
run Hello World as a client talking to a SuperDB server instance.
Continuing the example above (with the `SUPER_DB` environment pointing to `./scratch`),
run a service as follows:
Expand Down
22 changes: 9 additions & 13 deletions book/src/getting-started/install.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
## Installation
# Installation

> **TODO: upon release, update this first paragraph.**
SuperDB, along with its new query language [SuperSQL](../super-sql/intro.md),
is downloadable software available as a single binary embodied in
the [super](../command/super.md) command.

Because SuperDB is still under construction, GA releases are not yet available.
However, you can install a build of the [`super`](../command/super.md)
command-line tool based on code that's under active development to start
tinkering.

Multiple options for installing `super` are available:
* [Homebrew](#homebrew) for Mac or Linux,
* [Build from source](#building-from-source).
You can [install a pre-built binary](#homebrew)
or [build from source code](#building-from-source).

To install the SuperDB Python client, see the
[Python library documentation](../dev/libraries/python.md).

### Homebrew
## Homebrew

On macOS and Linux, you can use [Homebrew](https://brew.sh/) to install `super`:

Expand All @@ -23,7 +19,7 @@ brew install --cask brimdata/tap/super
```
Once installed, run a [quick test](hello-world.md).

### Building From Source
## Building From Source

>[!TIP]
> If you don't have Go installed, download and install it from the
Expand All @@ -38,6 +34,6 @@ go install github.com/brimdata/super/cmd/super@main

This installs the `super` binary in your `$GOPATH/bin`.

### Try It
## Try It

Once installed, run a [quick test](hello-world.md).
16 changes: 10 additions & 6 deletions book/src/getting-started/playground.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Playground
# Playground

If you have `super` installed, a common pattern for experimentation is to
If you have `super` [installed](install.md),
a common pattern for experimentation is to
"echo" some input to the `super -c` command, e.g.,
```
echo <values> | super -c <query> -
Expand All @@ -27,8 +28,8 @@ and you should get this alternative output in the RESULT panel above:
{out:"goodbye"}
```
The input in the playground examples are generally formatted as
[SUP](../formats/sup.md) but the `super` playground command autodetects
the format, so feel free to experiment with other text formats like CSV or JSON.
[SUP](../formats/sup.md) but the `super` playground command auto-detects
the format, so you can experiment with other text-based formats like CSV or JSON.
For example, if you change the input above to
```
id,message
Expand All @@ -37,12 +38,15 @@ id,message
```
`super` will detect this as CSV and you will get the same result.

### Examples
## Examples

To explore a broad range of SuperSQL functionality,
try browsing the documentation for
[pipe operators](../super-sql/operators/intro.md) or
[pipe operators](../super-sql/operators/intro.md),
[SQL operators](../super-sql/sql/intro.md#sql-operator),
or
[functions](../super-sql/functions/intro.md).

Each operator and function has a section of examples
with playgrounds where you can edit
the example queries and inputs to explore how SuperSQL works.
Expand Down
39 changes: 19 additions & 20 deletions book/src/getting-started/tldr.md
Original file line number Diff line number Diff line change
@@ -1,56 +1,55 @@
## TL;DR
# TL;DR

Don't have time to dive into the documentation?
Skim these one liners to get the gist of what SuperDB can do...

Just skim these one liners to get the gist of what SuperDB can do!
>[!NOTE]
> JSON inputs can include any concatenation of valid JSON values, e.g.,
> [newline-delimited JSON](https://github.com/ndjson/ndjson-spec),
> though newline delimiters are not required.

Note that JSON files can include any sequence of JSON values like
[newline-deliminted JSON](https://github.com/ndjson/ndjson-spec)
though the values need not be newline deliminated.

### Query a CSV, JSON, or Parquet file using SuperSQL
## Query a CSV, JSON, or Parquet file using SuperSQL
```
super -c "SELECT * FROM file.[csv|csv.gz|json|json.gz|parquet]"
```
### Run a SuperSQL query sourced from an input file
## Run a SuperSQL query sourced from an input file
```
super -I path/to/query.sql
```
### Pretty-print a sample value as super-structured data
## Pretty-print a sample value as super-structured data
```
super -S -c "limit 1" file.[csv|csv.gz|json|json.gz|parquet]
```
### Compute a histogram of the "data shapes" in a JSON file
## Compute a histogram of the "data shapes" in a JSON file
```
super -c "count() by typeof(this)" file.json
```
### Display a sample value of each "shape" of JSON data
## Display a sample value of each "shape" of JSON data
```
super -c "any(this) by typeof(this) | values any" file.json
```
### Search Parquet files easily and efficiently without schema handcuffs
## Search Parquet files easily and efficiently without schema handcuffs
```
super *.parquet > all.bsup
super -c "? search keywords | other pipe processing" all.bsup
```
### Read a CSV from stdin, process with a query, and write to stdout
## Read a CSV from stdin, process with a query, and write to stdout
```
cat input.csv | super -f csv -c <query> -
```
### Fuse JSON data into a unified schema and output as Parquet
## Fuse JSON data into a unified schema and output as Parquet
```
super -f parquet -o out.parquet -c fuse file.json
```
### Run as a calculator
## Run as a calculator
```
super -c "1.+(1/2.)+(1/3.)+(1/4.)"
```
### Search all values in a database pool called logs for keyword "alert" and level >= 2
## Search all values in a database pool called logs for keyword "alert" and level >= 2
```
super db -c "from logs | ? alert level >= 2"
```

### Traverse nested data with recursive functions and re-entrant subqueries
## Traverse nested data with recursive functions and re-entrant subqueries

```
super -c '
Expand All @@ -70,7 +69,7 @@ values 1, [1,2,3], [{x:[1,"foo"]},{y:2}]
'
```

### Handle and wrap errors in a SuperSQL pipeline
## Handle and wrap errors in a SuperSQL pipeline
```
... | super -c "
switch is_error(this) (
Expand All @@ -84,7 +83,7 @@ switch is_error(this) (
| ...
```

### Embed a pipe query search in SQL FROM clause
## Embed a pipe query search in SQL FROM clause

```
super -c "
Expand Down