This is an automated email from the ASF dual-hosted git repository.
victoria pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git
The following commit(s) were added to refs/heads/master by this push:
new 1c2744b31e Fix querying sql (#14026)
1c2744b31e is described below
commit 1c2744b31e9cb3d9eabb248fa69292919f26a29b
Author: Charles Smith <[email protected]>
AuthorDate: Thu Apr 6 14:50:06 2023 -0700
Fix querying sql (#14026)
Co-authored-by: Victoria Lim <[email protected]>
---
docs/assets/tutorial-query-01.png | Bin 48774 -> 78666 bytes
docs/assets/tutorial-query-02.png | Bin 86083 -> 90958 bytes
docs/assets/tutorial-query-03.png | Bin 120017 -> 118994 bytes
docs/assets/tutorial-query-04.png | Bin 135419 -> 136945 bytes
docs/assets/tutorial-query-05.png | Bin 153221 -> 135626 bytes
docs/assets/tutorial-query-06.png | Bin 138730 -> 135743 bytes
docs/assets/tutorial-query-07.png | Bin 149016 -> 148492 bytes
docs/tutorials/tutorial-query.md | 134 ++++++++++++++------------------------
8 files changed, 49 insertions(+), 85 deletions(-)
diff --git a/docs/assets/tutorial-query-01.png
b/docs/assets/tutorial-query-01.png
index c8455f6420..99354cbdfe 100644
Binary files a/docs/assets/tutorial-query-01.png and
b/docs/assets/tutorial-query-01.png differ
diff --git a/docs/assets/tutorial-query-02.png
b/docs/assets/tutorial-query-02.png
index 852d5fde24..4d789f5989 100644
Binary files a/docs/assets/tutorial-query-02.png and
b/docs/assets/tutorial-query-02.png differ
diff --git a/docs/assets/tutorial-query-03.png
b/docs/assets/tutorial-query-03.png
index 725d373b6f..841d36bfe8 100644
Binary files a/docs/assets/tutorial-query-03.png and
b/docs/assets/tutorial-query-03.png differ
diff --git a/docs/assets/tutorial-query-04.png
b/docs/assets/tutorial-query-04.png
index 8715cde1b2..7c713e367c 100644
Binary files a/docs/assets/tutorial-query-04.png and
b/docs/assets/tutorial-query-04.png differ
diff --git a/docs/assets/tutorial-query-05.png
b/docs/assets/tutorial-query-05.png
index a56a0ed5aa..4b3d78d155 100644
Binary files a/docs/assets/tutorial-query-05.png and
b/docs/assets/tutorial-query-05.png differ
diff --git a/docs/assets/tutorial-query-06.png
b/docs/assets/tutorial-query-06.png
index d17ae10cba..cb35a07871 100644
Binary files a/docs/assets/tutorial-query-06.png and
b/docs/assets/tutorial-query-06.png differ
diff --git a/docs/assets/tutorial-query-07.png
b/docs/assets/tutorial-query-07.png
index ddcda873cd..aa94d629f8 100644
Binary files a/docs/assets/tutorial-query-07.png and
b/docs/assets/tutorial-query-07.png differ
diff --git a/docs/tutorials/tutorial-query.md b/docs/tutorials/tutorial-query.md
index cd91e4101f..212528e479 100644
--- a/docs/tutorials/tutorial-query.md
+++ b/docs/tutorials/tutorial-query.md
@@ -144,18 +144,19 @@ performance issues. For more information, see [Native
queries](../querying/query
9. Finally, click `...` and **Edit context** to see how you can add
additional parameters controlling the execution of the query execution. In the
field, enter query context options as JSON key-value pairs, as described in
[Context flags](../querying/query-context.md).
That's it! We've built a simple query using some of the query builder features
built into the web console. The following
-sections provide a few more example queries you can try. Also, see [Other ways
to invoke SQL queries](#other-ways-to-invoke-sql-queries) to learn how
-to run Druid SQL from the command line or over HTTP.
+sections provide a few more example queries you can try.
+
+See [Query SQL over HTTP](#query-sql-over-http) for an example of how to use
the Druid SQL HTTP API.
## More Druid SQL examples
-Here is a collection of queries to try out:
+Try the following queries to learn a few more Druid SQL tricks:
### Query over time
```sql
SELECT FLOOR(__time to HOUR) AS HourTime, SUM(deleted) AS LinesDeleted
-FROM wikipedia WHERE TIME_IN_INTERVAL("__time", '2015-09-12/2015-09-13')
+FROM wikipedia WHERE TIME_IN_INTERVAL("__time", '2016-06-27/2016-06-28')
GROUP BY 1
```
@@ -165,58 +166,21 @@ GROUP BY 1
```sql
SELECT channel, page, SUM(added)
-FROM wikipedia WHERE TIME_IN_INTERVAL("__time", '2015-09-12/2015-09-13')
+FROM wikipedia WHERE TIME_IN_INTERVAL("__time", '2016-06-27/2016-06-28')
GROUP BY channel, page
ORDER BY SUM(added) DESC
```

-
-## Other ways to invoke SQL queries
-
-### Query SQL via dsql
-
-For convenience, the Druid package includes a SQL command-line client, located
at `bin/dsql` in the Druid package root.
-
-Let's now run `bin/dsql`; you should see the following prompt:
-
-```bash
-Welcome to dsql, the command-line client for Druid SQL.
-Type "\h" for help.
-dsql>
-```
-
-To submit the query, paste it to the `dsql` prompt and press enter:
-
-```bash
-dsql> SELECT page, COUNT(*) AS Edits FROM wikipedia WHERE
TIME_IN_INTERVAL("__time", '2015-09-12/2015-09-13') GROUP BY page ORDER BY
Edits DESC LIMIT 10;
-┌──────────────────────────────────────────────────────────┬───────┐
-│ page │ Edits │
-├──────────────────────────────────────────────────────────┼───────┤
-│ Wikipedia:Vandalismusmeldung │ 33 │
-│ User:Cyde/List of candidates for speedy deletion/Subpage │ 28 │
-│ Jeremy Corbyn │ 27 │
-│ Wikipedia:Administrators' noticeboard/Incidents │ 21 │
-│ Flavia Pennetta │ 20 │
-│ Total Drama Presents: The Ridonculous Race │ 18 │
-│ User talk:Dudeperson176123 │ 18 │
-│ Wikipédia:Le Bistro/12 septembre 2015 │ 18 │
-│ Wikipedia:In the news/Candidates │ 17 │
-│ Wikipedia:Requests for page protection │ 17 │
-└──────────────────────────────────────────────────────────┴───────┘
-Retrieved 10 rows in 0.06s.
-```
-
-
-### Query SQL over HTTP
+## Query SQL over HTTP
-You can submit native queries [directly to the Druid Broker over
HTTP](../querying/sql-api.md#submit-a-query). The request body should be a JSON
object, with the value for the key `query` containing text of the query:
+You can submit native queries [over
HTTP](../querying/sql-api.md#submit-a-query). The request body is a JSON object
in which the `query` field contains the text of the query:
```json
{
- "query": "SELECT page, COUNT(*) AS Edits FROM wikipedia WHERE
TIME_IN_INTERVAL(\"__time\", '2015-09-12/2015-09-13') GROUP BY page ORDER BY
Edits DESC LIMIT 10"
+ "query": "SELECT page, COUNT(*) AS Edits FROM wikipedia WHERE
TIME_IN_INTERVAL(\"__time\", '2016-06-27/2016-06-28') GROUP BY page ORDER BY
Edits DESC LIMIT 10"
}
```
@@ -230,46 +194,46 @@ The following results should be returned:
```json
[
- {
- "page": "Wikipedia:Vandalismusmeldung",
- "Edits": 33
- },
- {
- "page": "User:Cyde/List of candidates for speedy deletion/Subpage",
- "Edits": 28
- },
- {
- "page": "Jeremy Corbyn",
- "Edits": 27
- },
- {
- "page": "Wikipedia:Administrators' noticeboard/Incidents",
- "Edits": 21
- },
- {
- "page": "Flavia Pennetta",
- "Edits": 20
- },
- {
- "page": "Total Drama Presents: The Ridonculous Race",
- "Edits": 18
- },
- {
- "page": "User talk:Dudeperson176123",
- "Edits": 18
- },
- {
- "page": "Wikipédia:Le Bistro/12 septembre 2015",
- "Edits": 18
- },
- {
- "page": "Wikipedia:In the news/Candidates",
- "Edits": 17
- },
- {
- "page": "Wikipedia:Requests for page protection",
- "Edits": 17
- }
+ {
+ "page": "Copa América Centenario",
+ "Edits": 29
+ },
+ {
+ "page": "User:Cyde/List of candidates for speedy deletion/Subpage",
+ "Edits": 16
+ },
+ {
+ "page": "Wikipedia:Administrators' noticeboard/Incidents",
+ "Edits": 16
+ },
+ {
+ "page": "2016 Wimbledon Championships – Men's Singles",
+ "Edits": 15
+ },
+ {
+ "page": "Wikipedia:Administrator intervention against vandalism",
+ "Edits": 15
+ },
+ {
+ "page": "Wikipedia:Vandalismusmeldung",
+ "Edits": 15
+ },
+ {
+ "page": "The Winds of Winter (Game of Thrones)",
+ "Edits": 12
+ },
+ {
+ "page": "ولاية الجزائر",
+ "Edits": 12
+ },
+ {
+ "page": "Copa América",
+ "Edits": 10
+ },
+ {
+ "page": "Lionel Messi",
+ "Edits": 10
+ }
]
```
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]