DeltaControl
DeltaControl
is a class that defines ways to handle null values during Delta updateBy
operations, where Delta
operations return the difference between the current row and the previous row.
Syntax
DeltaControl(value)
Parameters
Parameter | Type | Description |
---|---|---|
value | Enum | Defines how special cases should behave. When
|
Returns
An instance of a DeltaControl
class that can be used in an updateBy
Delta
operation.
Examples
The following example creates a newTable
with three rows of int
columns. Next, it creates three DeltaControl
objects. Finally, it uses updateBy
and invokes the Delta
UpdateByOperation to demonstrate how the three Enum values for DeltaControl
affect the output.
null_dominates = DeltaControl.NULL_DOMINATES
value_dominates = DeltaControl.VALUE_DOMINATES
zero_dominates = DeltaControl.ZERO_DOMINATES
source = newTable(
intCol("X", 1, NULL_INT, 3, NULL_INT, 5, NULL_INT, NULL_INT, 8, 9),
intCol("Y", 0, 5, 3, NULL_INT, NULL_INT, 3, 0, NULL_INT, 9),
intCol("Z", 5, 6, 3, 4, 2, NULL_INT, 5, 0, 3)
)
result = source.updateBy([
Delta(null_dominates, "X_null = X", "Y_null = Y", "Z_null = Z"),
Delta(value_dominates, "X_value = X", "Y_value = Y", "Z_value = Z"),
Delta(zero_dominates, "X_zero = X", "Y_zero = Y", "Z_zero = Z"),
])
- source
- result