Interface GroupedExpressionValues
A window stage that runs after grouping sees one row per group, and those rows no longer carry the
values an aggregate would need: ROW_NUMBER() OVER (ORDER BY SUM(b)) has to know each group's
SUM(b), and LAG(SUM(b)) OVER (…) has to know it as an ARGUMENT. Where the aggregate is also a
SELECT item its computed value can be read positionally, but it need not be — and then the only place
left to compute it is the group the output row came from.
Implemented by the query executor, which holds the output-row-to-group map; the window evaluator asks through this interface so it never has to know how grouping stored its rows.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ObjectAnswered when the expression cannot be computed over a group, so the caller keeps its own path. -
Method Summary
Modifier and TypeMethodDescriptionThe FROM clause's alias map paired withbaseTable(), or null for a single relation.Every joined relation paired withbaseTable(), or null for a single relation.The relation the groups were formed over — the FROM table the projected rows no longer are.The expression's value for one grouped output row.
-
Field Details
-
UNRESOLVED
Answered when the expression cannot be computed over a group, so the caller keeps its own path.
-
-
Method Details
-
valueOf
The expression's value for one grouped output row.- Parameters:
projectedRow- the output row, one per groupexpressionText- the expression as written- Returns:
- the value, or
UNRESOLVEDwhen this row has no group or the text does not compute
-
baseTable
Table baseTable()The relation the groups were formed over — the FROM table the projected rows no longer are.A window stage over grouped rows resolves VALUES against the projected shape, but a DECLARED type is a property of the base relation:
RATIO_TO_REPORT(SUM(a)) OVER ()besideGROUP BY ais NUMBER(30,8) on the account becauseais the NUMBER(10,2) column it always was, not the untyped slot the projection put it in. This is where that relation is found.- Returns:
- the base table, never null
-
aliasToTable
The FROM clause's alias map paired withbaseTable(), or null for a single relation.- Returns:
- alias to table, or null
-
allTables
Every joined relation paired withbaseTable(), or null for a single relation.- Returns:
- the joined tables, or null
-