Querying Pinot
Learn how to query Pinot using SQL
Last updated
Was this helpful?
Learn how to query Pinot using SQL
Last updated
Was this helpful?
Pinot uses Calcite SQL Parser to parse queries and uses MYSQL_ANSI dialect. You can see the grammar .
Pinot does not support Joins or nested Subqueries and we recommend using Presto for queries that span multiple tables. Read for more info.
No DDL support. Tables can be created via the .
In Pinot SQL:
Double quotes(") are used to force string identifiers, e.g. column name.
Single quotes(') are used to enclose string literals.
Mis-using those might cause unexpected query results:
E.g.
WHERE a='b'
means the predicate on the column a
equals to a string literal value 'b'
WHERE a="b"
means the predicate on the column a
equals to the value of the column b
Use single quotes for literals and double quotes (optional) for identifiers (column names)
If you name the columns as timestamp
, date
, or other reserved keywords, or the column name includes special characters, you need to use double quotes when you refer to them in the query.
Note: results might not be consistent if column ordered by has same value in multiple rows.
To count rows where the column airlineName
starts with U
Pinot supports the CASE-WHEN-ELSE statement.
Example 1:
Example 2:
Pinot supports queries on BYTES column using HEX string. The query response also uses hex string to represent bytes value.
E.g. the query below fetches all the rows for a given UID.
For performant filtering of ids in a list, see .
Functions have to be implemented within Pinot. Injecting functions is not yet supported. The example below demonstrate the use of UDFs. More examples in