AQL Operators
A key component of AQL's query syntax involves the utilization of operators to generate more precise metrics.
Logical Operator
These operators serve to compare values and yield a truefalse result.
Text
Operator | Example | Description |
---|---|---|
== is | products.name == 'Dandelion' products.name is 'Dandelion' | Equal to |
!= is not | products.name != 'Rock' products.name is not 'Rock' | Not equal to |
like | products.name like '%Dan' | Match the pattern specified |
not like | products.name not like '%Dan' | Not match the pattern specified |
ilike | products.name ilike '%dan' | Match the pattern specified, case insensitive |
not ilike | products.name not ilike '%dan' | Not match the pattern specified, case insensitive |
is null | products.name is null | Include if the value is null |
is not null | products.name is not null | Include if the value is not null |
List
Operator | Example | Description |
---|---|---|
in | products.name in ['Dandelion', 'Rock'] | Include if the value is in the list |
not in | products.name not in ['Dandelion', 'Rock'] | Include if the value is not in the list |
Truefalse
Operator | Example | Description |
---|---|---|
is | orders.is_paid is true | Equal to |
is not | orders.is_paid is not true | Not equal to |
is null | orders.is_paid is null | Include if null |
is not null | orders.is_paid is not null | Include if is not null |
Number
Operator | Example | Description |
---|---|---|
== is | order_items.discount == 0.5 order_items.discount is 0.5 | Equal to |
!= is not | order_items.discount != 1 order_items.discount is not 1 | Not equal to |
> | order_items.discount > 0.5 | Greater than |
< | order_items.discount < 0.5 | Less than |
is null | order_items.discount is null | Include if null |
is not null | order_items.discount is not null | Include if is not null |
Datetime
Right hand side of datetime operator takes a datetime scalar type as input and always starts with @
token. Datetimes can be expressed in a fully supported format as @YYYY-MM-DD HH:MM:SS
, in shorter variations like @YYYY-MM
, or relative datetime
Operator | Example | Meaning | Description |
---|---|---|---|
== | - orders.created_at == @2022 - orders.created_at == @(last 7 days) | - orders.created_at equal to 2022-01-01 00:00:00 - orders_created_at equal to the first timestamp of the last 7 days | Convert the condition input to an absolute timestamp, and include data that match this condition |
is matches match | - orders.created_at is @2022 - orders.created_at match @(last 7 days) | - orders.created_at is in the period of the year 2022 - order.created_at is in the period of the last 7 days | Convert the condition input to a time period, and include data that match this condition |
!= | orders.created_at != @2022-01 | - orders.created_at is not equal to 2022-01-01 00:00:00 | Convert the condition input to an absolute timestamp, and exclude data that match this condition |
< | orders.created_at < @2022 | - orders.created_at is before the year 2022 | Include data that are before a specific time period |
> | orders.created_at > @(yesterday) | - orders.created_at is after yesterday | Include data that are after a specific time period |
is not | orders.created_at is not @2022-01 | - orders.created_at is not in the period of 2022-01 | Convert the condition input to a time period, and exclude data that match this condition |
is null | orders.created_at is null | - orders.created_at is not in the period of 2022-01 | Include if the value is null |
is not null | orders.created_at is not null | - orders.created_at is not in the period of 2022-01 | Include if the value is not null |
Pipe Operator
In AQL, we use the pipe |
operator to combine multiple expressions into a pipeline in which the output of the previous expression will become the input for the next expression.
Example:
orders | filter(orders.country = 'Singapore') | sum(orders.total_value)
Check AQL Pipe for more information on using pipe