You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by mc...@apache.org on 2019/11/04 22:33:13 UTC

[incubator-pinot] 12/13: Add documenation for queryOptions groupByMode and responseFormat (#4708)

This is an automated email from the ASF dual-hosted git repository.

mcvsubbu pushed a commit to branch 0.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 67ecd17381ffb39b92b9fda77acee4ee58121d13
Author: Neha Pawar <np...@linkedin.com>
AuthorDate: Mon Oct 14 17:33:56 2019 -0700

    Add documenation for queryOptions groupByMode and responseFormat (#4708)
---
 docs/pql_examples.rst | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/docs/pql_examples.rst b/docs/pql_examples.rst
index 24a4e08..2e9490b 100644
--- a/docs/pql_examples.rst
+++ b/docs/pql_examples.rst
@@ -295,3 +295,41 @@ will be the same as the combining results from the following queries:
     TOP 50
 
 where we don't put the results for the same group together.
+
+
+* We are beginning work on standard sql support. As a first step, we have introduced ``ORDER BY``. 
+
+In order to use ``ORDER BY`` certain options need to be set in the request json payload:
+
+1. ``groupByMode`` - Setting this to ``sql`` will take the code path of standard sql, and hence accept ``ORDER BY``. By default, this is ``pql``
+
+.. code-block:: json
+
+  { 
+    "pql" : "SELECT COUNT(*) from myTable GROUP BY foo ORDER BY foo DESC TOP 100", 
+    "queryOptions" : "groupByMode=sql" 
+  }
+
+2. ``responseFormat`` - Setting this to ``sql`` will present results in the standard sql way i.e. tabular, with same keys across all aggregations. This only works when used in combination with ``groupByMode=sql``. By default, this is ``pql``
+
+.. code-block:: json
+
+  { 
+    "pql" : "SELECT SUM(foo), SUM(bar) from myTable GROUP BY moo ORDER BY SUM(bar) ASC, moo DESC TOP 10", 
+    "queryOptions" : "groupByMode=sql;responseFormat=sql"
+  }
+
+ResultTable looks as follows:
+
+.. code-block:: json
+
+  {
+    "resultTable": {
+      "columns":["moo", "SUM(foo)","SUM(bar)"],
+      "results":[["abc", 10, 100],
+                 ["pqr", 20, 200],
+                 ["efg", 20, 200],
+                 ["lmn", 30, 300]]
+  }
+
+These options are also available on the query console (checkboxes ``Group By Mode: SQL`` and ``Response Format: SQL``)


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