public final class WindowSpec extends Object
OutputColumn is built from a SELECT-list
expression of the form FUNC(arg) OVER (PARTITION BY ... ORDER
BY ... ROWS BETWEEN ...), the IR records the PARTITION BY / OVER
ORDER BY column refs here; the function args remain in
OutputColumn.getSources(); the optional frame clause is
captured in getFrame() (slice 22).
Refs are in-scope, not necessarily base-table. Each
ColumnRef is what NameBindingProvider
returned during the build, so a window function in a CTE body may
reference the CTE's local relation alias. Consumers must walk
SemanticProgram.getLineage() to resolve final base columns.
Empty windows are forbidden by construction. The slice-13
builder rejects OVER () (no PARTITION BY AND no OVER ORDER
BY) before reaching this constructor, because the dlineage XML for
an empty-OVER window function is byte-identical to a plain aggregate
(no discriminator → would manufacture an
DivergenceClass.AGGREGATION_MISMATCH
by design). The constructor enforces the same invariant defensively
so a future builder mistake fails loudly here rather than producing
a silently empty WindowSpec.
Frame substitution is forbidden. A frame clause does NOT
substitute for a non-empty PARTITION BY / OVER ORDER BY. The
empty-OVER guard fires before the frame is built, so a frame-only
OVER (ROWS BETWEEN ...) is rejected before reaching this
constructor (slice-22 invariant).
| Constructor and Description |
|---|
WindowSpec(List<ColumnRef> partitionRefs,
List<ColumnRef> orderRefs)
Slice-13 two-arg constructor.
|
WindowSpec(List<ColumnRef> partitionRefs,
List<ColumnRef> orderRefs,
WindowFrame frame)
Slice-22 three-arg constructor.
|
| Modifier and Type | Method and Description |
|---|---|
WindowFrame |
getFrame() |
List<ColumnRef> |
getOrderRefs() |
List<ColumnRef> |
getPartitionRefs() |
public WindowSpec(List<ColumnRef> partitionRefs, List<ColumnRef> orderRefs)
frame = null; preserved for source compatibility.public WindowSpec(List<ColumnRef> partitionRefs, List<ColumnRef> orderRefs, WindowFrame frame)
frame is nullable; null means
the projection had no ROWS/RANGE/GROUPS
clause inside its OVER (...).public List<ColumnRef> getPartitionRefs()
public List<ColumnRef> getOrderRefs()
public WindowFrame getFrame()