Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
abhishekrb19 merged PR #16277: URL: https://github.com/apache/druid/pull/16277 -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
abhishekrb19 commented on code in PR #16277: URL: https://github.com/apache/druid/pull/16277#discussion_r1565107060 ## docs/development/extensions-core/stats.md: ## @@ -56,6 +56,19 @@ Numer. Math, 58 (1991) pp. 583--590 precisely the same across query runs. ::: +### Variance Aggregator in Druid SQL Review Comment: ```suggestion ### Variance and Standard Deviation SQL Aggregators ``` -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
nrao57 commented on PR #16277: URL: https://github.com/apache/druid/pull/16277#issuecomment-2053762232 I added the TopN Druid SQL query and a table describing the sql variance and stdev functions. Let me know if anything needs to change. -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
abhishekrb19 commented on code in PR #16277: URL: https://github.com/apache/druid/pull/16277#discussion_r1563322067 ## docs/development/extensions-core/stats.md: ## @@ -120,13 +132,19 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ], "intervals": [ -"2016-03-01T00:00:00.000/2013-03-20T00:00:00.000" +"2016-03-01/2013-03-20" ] } ``` ### TopN query + Druid SQL + +There is no equivalent SQL for this query. Review Comment: Looking at this, it's possible to have a topN query -- the groupBy query below with an `ORDER BY` on one dimension and a `LIMIT` clause should plan the query as a `topN`. You could verify this by running `EXPLAIN PLAN FOR` ## docs/development/extensions-core/stats.md: ## @@ -107,6 +107,18 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat ### Timeseries query + Druid SQL + +```SQL Review Comment: It will also be nice to include a mention of the SQL functions `VARIANCE` and `STDDEV` in the above section where it provides the native JSON syntaxes -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
nrao57 commented on PR #16277: URL: https://github.com/apache/druid/pull/16277#issuecomment-2052539764 My mistake I removed the old duplicate sections -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
abhishekrb19 commented on code in PR #16277: URL: https://github.com/apache/druid/pull/16277#discussion_r1563192124 ## docs/development/extensions-core/stats.md: ## @@ -120,13 +132,33 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ], "intervals": [ -"2016-03-01T00:00:00.000/2013-03-20T00:00:00.000" +"2016-03-01/2013-03-20" ] } ``` + Druid SQL + +```SQL +SELECT + DATE_TRUNC('day', __time), Review Comment: Should be removed now that it's moved up? ## docs/development/extensions-core/stats.md: ## @@ -177,7 +228,18 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ], "intervals": [ -"2016-03-06T00:00:00/2016-03-06T23:59:59" +"2016-03-06/2016-03-07" ] } ``` + + Druid SQL + +```SQL +SELECT Review Comment: Same here -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
nrao57 commented on PR #16277: URL: https://github.com/apache/druid/pull/16277#issuecomment-2052514001 Hi @abhishekrb19! I have updated the Pull Request to reflect your suggestions. Please let me know if there is anything else. -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
Re: [PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
abhishekrb19 commented on code in PR #16277: URL: https://github.com/apache/druid/pull/16277#discussion_r1563058032 ## docs/development/extensions-core/stats.md: ## @@ -125,8 +126,24 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ``` + Druid SQL Review Comment: It would be preferable to move the SQL query section before the native query section since SQL is more widely used and familiar to users. Same suggestion for all the SQL sections in this page. ## docs/development/extensions-core/stats.md: ## @@ -181,3 +206,14 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat ] } ``` + + Druid SQL + +```SQL +SELECT + alias, + VARIANCE("index") AS index_var +FROM "testing" +WHERE TIME_IN_INTERVAL(__time, '2016-03-06T00:00:00/2016-03-06T23:59:59') Review Comment: End date is exclusive, so I would think this should be start of the next day? Same for the native query: ```suggestion WHERE TIME_IN_INTERVAL(__time, '2016-03-06/2016-03-07') ``` ## docs/development/extensions-core/stats.md: ## @@ -154,8 +171,16 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ``` + Druid SQL + +```SQL +There is no equivalent SQL for this query. Review Comment: Perhaps move this text outside the sql codeblock? ## docs/development/extensions-core/stats.md: ## @@ -125,8 +126,24 @@ To acquire standard deviation from variance, user can use "stddev" post aggregat } ``` + Druid SQL + +```SQL +SELECT + DATE_TRUNC('day', __time), + VARIANCE("index_var") +FROM + "testing" +WHERE + TIME_IN_INTERVAL(__time, '2013-03-01T00:00:00.000/2016-03-20T00:00:00.000') +GROUP BY + DATE_TRUNC('day', __time) Review Comment: Small simplification: ```suggestion SELECT DATE_TRUNC('day', __time), VARIANCE("index_var") AS index_var FROM "testing" WHERE TIME_IN_INTERVAL(__time, '2013-03-01/2016-03-20') GROUP BY 1 ``` -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org
[PR] Adds Druid SQL query examples for the Stats aggregator Native Queries (druid)
nrao57 opened a new pull request, #16277: URL: https://github.com/apache/druid/pull/16277 Adds Druid SQL query examples for the Stats aggregator Native Queries Fixes #13148. ### Description This PR adds Druid SQL query examples for the Stats aggregator documents page. Currently, there are only examples for the Native queries. This PR adds SQL code examples to fix this issue. This PR has: - [x] been self-reviewed. - [x] added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader. -- 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. To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org - To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org