jfim commented on a change in pull request #3563: Re-org documentation URL: https://github.com/apache/incubator-pinot/pull/3563#discussion_r237258120
########## File path: docs/pql_examples.rst ########## @@ -224,11 +190,72 @@ For example, the following query will calculate the maximum value of column ``fo Supported transform functions ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``ADD`` + Sum of at least two values + +``SUB`` + Difference between two values -* ``ADD``: sum of at least two values -* ``SUB``: difference between two values -* ``MULT``: product of at least two values -* ``DIV``: quotient of two values -* ``TIMECONVERT``: takes 3 arguments, converts the value into another time unit. E.g. ``TIMECONVERT(time, 'MILLISECONDS', 'SECONDS')`` -* ``DATETIMECONVERT``: takes 4 arguments, converts the value into another date time format, and buckets time based on the given time granularity. E.g. ``DATETIMECONVERT(date, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES')`` -* ``VALUEIN``: takes at least 2 arguments, where the first argument is a multi-valued column, and the following arguments are constant values. The transform function will filter the value from the multi-valued column with the given constant values. The ``VALUEIN`` transform function is especially useful when the same multi-valued column is both filtering column and grouping column. E.g. ``VALUEIN(mvColumn, 3, 5, 15)`` +``MULT`` + Product of at least two values + +``DIV`` + Quotient of two values + +``TIMECONVERT`` + Takes 3 arguments, converts the value into another time unit. E.g. ``TIMECONVERT(time, 'MILLISECONDS', 'SECONDS')`` + +``DATETIMECONVERT`` + Takes 4 arguments, converts the value into another date time format, and buckets time based on the given time granularity. + *e.g.* ``DATETIMECONVERT(date, '1:MILLISECONDS:EPOCH', '1:SECONDS:EPOCH', '15:MINUTES')`` + +``VALUEIN`` + Takes at least 2 arguments, where the first argument is a multi-valued column, and the following arguments are constant values. + The transform function will filter the value from the multi-valued column with the given constant values. + The ``VALUEIN`` transform function is especially useful when the same multi-valued column is both filtering column and grouping column. + *e.g.* ``VALUEIN(mvColumn, 3, 5, 15)`` + + +Differences with SQL +-------------------- + +* ``JOIN`` is not supported +* Use ``TOP`` instead of ``LIMIT`` for truncation +* ``LIMIT n`` has no effect in grouping queries, should use ``TOP n`` instead. If no ``TOP n`` defined, PQL will use ``TOP 10`` as default truncation setting. +* No need to select the columns to group with. + +The following two queries are both supported in PQL, where the non-aggregation columns are ignored. + +.. code-block:: sql + + SELECT MIN(foo), MAX(foo), SUM(foo), AVG(foo) FROM mytable + GROUP BY bar, baz + TOP 50 + + SELECT bar, baz, MIN(foo), MAX(foo), SUM(foo), AVG(foo) FROM mytable + GROUP BY bar, baz + TOP 50 + +* Always order by the aggregated value + The results will always order by the aggregated value itself. Review comment: Ascending or descending order? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
