For the complete documentation index, see llms.txt. This page is also available as Markdown.

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:

=, <>, <, <=, >, >=

Explicit ROW() syntax is not supported. Use implicit parenthesized expressions such as (col1, col2) > (1, 2) instead of ROW(col1, col2) > ROW(1, 2).

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:

  • WHERE clauses

  • comparison predicates inside subqueries

  • comparison predicates inside CTEs

Examples:

Unsupported contexts

Row expressions are rejected outside comparison predicates. In particular, they are not supported in:

  • SELECT lists

  • GROUP BY

  • ORDER BY

  • function 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?