Row Expression Comparison
Pinot supports implicit row-style comparisons in multi-stage queries. These comparisons are useful for keyset pagination and other lexicographic comparisons across multiple columns.
Pinot does not materialize a row type at runtime. Instead, it rewrites the comparison during planning using the same lexicographic semantics described in the jOOQ row-value comparison transformations.
Supported syntax
Use a parenthesized list of expressions on both sides of one of the supported comparison operators:
WHERE (col1, col2, col3) > (val1, val2, val3)Supported comparison operators:
=, <>, <, <=, >, >=Validation rules
Pinot validates row-style comparisons before planning the query:
Both sides of the comparison must be row expressions.
Both row expressions must have the same number of fields.
Row expressions cannot be empty.
Row expressions are only supported in comparison predicates.
If any of these checks fail, Pinot rejects the query during validation.
Supported contexts
Row-style comparisons are supported in comparison predicates, including:
WHEREclausescomparison predicates inside subqueries
comparison predicates inside CTEs
Examples:
Unsupported contexts
Row expressions are rejected outside comparison predicates. In particular, they are not supported in:
SELECTlistsGROUP BYORDER BYfunction arguments
Examples that Pinot rejects:
Semantics
Row comparisons are lexicographic, not element-wise. For example:
is equivalent to:
Likewise:
is equivalent to:
Last updated
Was this helpful?

