Record Class DownsampleNode
- Record Components:
timestampColumn- the input column of type TIMESTAMP to bucket; never nullinterval- the bucket width — ISO-8601 or shorthand; never nullfunction- the consolidation function; never nullgroupingKeys- optional additional grouping columns (PER clause); never nullmaxRows- optional limit on the number of output buckets (FOR n ROWS)input- the source relation; never nulllocation- source position of this node; never null
- All Implemented Interfaces:
RelNode
ConsolidationFunction.
Syntax:
DOWNSAMPLE ts BY '5m' USING AVG (Metrics) DOWNSAMPLE ts BY '1h' USING MAX PER host (NetworkData) DOWNSAMPLE ts BY 'P1D' USING SUM PER region FOR 30 ROWS (Events)
The timestampColumn must be of type TIMESTAMP in the input schema.
The interval accepts ISO-8601 duration strings (PT5M, PT1H,
P1D) as well as shorthand notation (5m, 1h, 1d).
Output schema: groupingKeys columns (same types) + bucket: TIMESTAMP
+ consolidated columns. For ConsolidationFunction.COUNT the consolidated column
is a single count: NUMBER; for all other functions each NUMBER column
that is not the timestamp column and not a grouping key becomes
<fn>_<colname>: NUMBER (e.g. avg_value, sum_amount).
When maxRows is present, only the N most-recent buckets are emitted
(sort by bucket DESC, take N).
Materialisation: MaterializationMode.BAG (groups all rows before emitting).
-
Constructor Summary
ConstructorsConstructorDescriptionDownsampleNode(String timestampColumn, String interval, ConsolidationFunction function, List<String> groupingKeys, OptionalLong maxRows, RelNode input) Convenience constructor for tests; usesSourceLocation.UNKNOWN.DownsampleNode(String timestampColumn, String interval, ConsolidationFunction function, List<String> groupingKeys, OptionalLong maxRows, RelNode input, SourceLocation location) Creates an instance of aDownsampleNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) final booleanIndicates whether some other object is "equal to" this one.function()Returns the value of thefunctionrecord component.Returns the value of thegroupingKeysrecord component.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.interval()Returns the value of theintervalrecord component.location()Returns the value of thelocationrecord component.maxRows()Returns the value of themaxRowsrecord component.static longparseIntervalSeconds(String interval) Parses the interval string to a number of seconds.Returns the value of thetimestampColumnrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.ast.RelNode
children, mapChildren, materializationMode, prettyPrint
-
Constructor Details
-
DownsampleNode
public DownsampleNode(String timestampColumn, String interval, ConsolidationFunction function, List<String> groupingKeys, OptionalLong maxRows, RelNode input, SourceLocation location) Creates an instance of aDownsampleNoderecord class.- Parameters:
timestampColumn- the value for thetimestampColumnrecord componentinterval- the value for theintervalrecord componentfunction- the value for thefunctionrecord componentgroupingKeys- the value for thegroupingKeysrecord componentmaxRows- the value for themaxRowsrecord componentinput- the value for theinputrecord componentlocation- the value for thelocationrecord component
-
DownsampleNode
public DownsampleNode(String timestampColumn, String interval, ConsolidationFunction function, List<String> groupingKeys, OptionalLong maxRows, RelNode input) Convenience constructor for tests; usesSourceLocation.UNKNOWN.
-
-
Method Details
-
accept
-
parseIntervalSeconds
Parses the interval string to a number of seconds.Supports shorthand notation (
5m,1h,30s,2d,1w) and ISO-8601 duration strings (PT5M,PT1H,P1D).- Parameters:
interval- the interval string; never null- Returns:
- the interval width in seconds; always positive
- Throws:
IllegalArgumentException- if the string is not a recognised format or is non-positive
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
timestampColumn
Returns the value of thetimestampColumnrecord component.- Returns:
- the value of the
timestampColumnrecord component
-
interval
Returns the value of theintervalrecord component.- Returns:
- the value of the
intervalrecord component
-
function
Returns the value of thefunctionrecord component.- Returns:
- the value of the
functionrecord component
-
groupingKeys
Returns the value of thegroupingKeysrecord component.- Returns:
- the value of the
groupingKeysrecord component
-
maxRows
Returns the value of themaxRowsrecord component.- Returns:
- the value of the
maxRowsrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
location
Returns the value of thelocationrecord component.
-