You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/06/12 18:37:19 UTC

[GitHub] [incubator-druid] jihoonson commented on a change in pull request #7863: Added the web console to the quickstart tutorials and docs

jihoonson commented on a change in pull request #7863: Added the web console to the quickstart tutorials and docs
URL: https://github.com/apache/incubator-druid/pull/7863#discussion_r293060040
 
 

 ##########
 File path: docs/content/tutorials/tutorial-query.md
 ##########
 @@ -167,119 +156,51 @@ The following results should be returned:
 ]
 ```
 
-### dsql client
+### More Druid SQL examples
 
-For convenience, the Druid package includes a SQL command-line client, located at `bin/dsql` from the Druid package root.
+Here is a collection of queries to try out:
 
-Let's now run `bin/dsql`; you should see the following prompt:
+#### Query over time
 
-```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" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' 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.
+SELECT FLOOR(__time to HOUR) AS HourTime, SUM(deleted) AS LinesDeleted
+FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00'
+GROUP BY 1
 ```
 
-### Additional Druid SQL queries
+![Query example](../tutorials/img/tutorial-query-03.png "Query example")
 
-#### Timeseries
+#### General group by
 
-`SELECT FLOOR(__time to HOUR) AS HourTime, SUM(deleted) AS LinesDeleted FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' GROUP BY FLOOR(__time to HOUR);`
-
-```bash
-dsql> SELECT FLOOR(__time to HOUR) AS HourTime, SUM(deleted) AS LinesDeleted FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' GROUP BY FLOOR(__time to HOUR);
-┌──────────────────────────┬──────────────┐
-│ HourTime                 │ LinesDeleted │
-├──────────────────────────┼──────────────┤
-│ 2015-09-12T00:00:00.000Z │         1761 │
-│ 2015-09-12T01:00:00.000Z │        16208 │
-│ 2015-09-12T02:00:00.000Z │        14543 │
-│ 2015-09-12T03:00:00.000Z │        13101 │
-│ 2015-09-12T04:00:00.000Z │        12040 │
-│ 2015-09-12T05:00:00.000Z │         6399 │
-│ 2015-09-12T06:00:00.000Z │         9036 │
-│ 2015-09-12T07:00:00.000Z │        11409 │
-│ 2015-09-12T08:00:00.000Z │        11616 │
-│ 2015-09-12T09:00:00.000Z │        17509 │
-│ 2015-09-12T10:00:00.000Z │        19406 │
-│ 2015-09-12T11:00:00.000Z │        16284 │
-│ 2015-09-12T12:00:00.000Z │        18672 │
-│ 2015-09-12T13:00:00.000Z │        30520 │
-│ 2015-09-12T14:00:00.000Z │        18025 │
-│ 2015-09-12T15:00:00.000Z │        26399 │
-│ 2015-09-12T16:00:00.000Z │        24759 │
-│ 2015-09-12T17:00:00.000Z │        19634 │
-│ 2015-09-12T18:00:00.000Z │        17345 │
-│ 2015-09-12T19:00:00.000Z │        19305 │
-│ 2015-09-12T20:00:00.000Z │        22265 │
-│ 2015-09-12T21:00:00.000Z │        16394 │
-│ 2015-09-12T22:00:00.000Z │        16379 │
-│ 2015-09-12T23:00:00.000Z │        15289 │
-└──────────────────────────┴──────────────┘
-Retrieved 24 rows in 0.08s.
+```
+SELECT channel, page, SUM(added)
+FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00'
+GROUP BY channel, page
+ORDER BY SUM(added) DESC
 ```
 
-#### GroupBy
+![Query example](../tutorials/img/tutorial-query-04.png "Query example")
 
-`SELECT channel, SUM(added) FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' GROUP BY channel ORDER BY SUM(added) DESC LIMIT 5;`
+#### Select raw data
 
-```bash
-dsql> SELECT channel, SUM(added) FROM wikipedia WHERE "__time" BETWEEN TIMESTAMP '2015-09-12 00:00:00' AND TIMESTAMP '2015-09-13 00:00:00' GROUP BY channel ORDER BY SUM(added) DESC LIMIT 5;
-┌───────────────┬─────────┐
-│ channel       │ EXPR$1  │
-├───────────────┼─────────┤
-│ #en.wikipedia │ 3045299 │
-│ #it.wikipedia │  711011 │
-│ #fr.wikipedia │  642555 │
-│ #ru.wikipedia │  640698 │
-│ #es.wikipedia │  634670 │
-└───────────────┴─────────┘
-Retrieved 5 rows in 0.05s.
+```
 
 Review comment:
   nit: you can enable sql syntax with ` ```sql`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org