Skip to content

Commit

Permalink
Update the federated-queries doc (#655)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sevenannn authored Nov 28, 2024
1 parent 6c25309 commit 665fbd7
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions spiceaidocs/docs/features/federated-queries/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,7 @@ spice init demo
cd demo
```

**Step 5.** Start the Spice runtime.

```bash
spice run
```

**Step 6.** Open a new terminal, navigate back to the `demo` directory and add the `spiceai/fed-demo` Spicepod.
**Step 5.** Add the `spiceai/fed-demo` Spicepod.

```bash
# Change to demo directory.
Expand All @@ -58,6 +52,12 @@ spice add spiceai/fed-demo

Note in the Spice runtime output several datasets are loaded.

**Step 6.** Start the Spice runtime.

```bash
spice run
```

**Step 7.** Show available tables and query them, regardless of source.

```bash
Expand Down Expand Up @@ -95,7 +95,7 @@ SELECT *
FROM dremio_source_accelerated LIMIT 10
```

**Step 8.** Join tables across remote sources and query
**Step 8.** Join tables across remote sources and locally accelerated source

```sql
-- Query across S3, PostgreSQL, and Dremio
Expand All @@ -110,26 +110,26 @@ WITH order_numbers AS (
SELECT
AVG(total_amount),
passenger_count
FROM dremio_source
FROM dremio_source_accelerated
WHERE passenger_count IN (
SELECT DISTINCT order_number % 10 AS num_of_passenger
FROM order_numbers
)
GROUP BY passenger_count;

+---------------------------------+-----------------+
| AVG(dremio_source.total_amount) | passenger_count |
+---------------------------------+-----------------+
| 17.219515789473693 | 4 |
| 22.401176470588233 | 6 |
| 21.12263157894737 | 5 |
| 17.441359661495103 | 3 |
| 23.2 | 0 |
| 17.714222499449477 | 2 |
| 15.394881909237105 | 1 |
+---------------------------------+-----------------+

Time: 3.345525166 seconds. 7 rows.
+---------------------------------------------+-----------------+
| avg(dremio_source_accelerated.total_amount) | passenger_count |
+---------------------------------------------+-----------------+
| 17.441359661495113 | 3 |
| 22.401176470588233 | 6 |
| 21.122631578947367 | 5 |
| 17.219515789473697 | 4 |
| 17.71422249944938 | 2 |
| 15.394881909237206 | 1 |
| 23.2 | 0 |
+---------------------------------------------+-----------------+

Time: 0.557610333 seconds. 7 rows.
```

**Step 9.** Join tables across locally accelerated sources and query
Expand Down

0 comments on commit 665fbd7

Please sign in to comment.