OperationControl

OperationControl is a Python class that defines the control parameters of some UpdateByOperations used in an update_by table operation. The UpdateByOperations can use OperationControl to handle erroneous data are:

Syntax

Parameters

ParameterTypeDescription
on_nullBadDataBehavior

Defines how an UpdateByOperation handles null values it encounters. SKIP is the default. The following values are available:

  • POISON: Allow bad data to poison the result. This is only valid for use with NaN.
  • RESET: Reset the state for the bucket to None when invalid data is encountered.
  • SKIP: Skip and do not process the invalid data without changing state.
  • THROW: Throw an exception and abort processing when bad data is encountered.
on_nanBadDataBehavior

Defines how an UpdateByOperation handles NaN values it encounters. SKIP is the default. The following values are available:

  • POISON: Allow bad data to poison the result. This is only valid for use with NaN.
  • RESET: Reset the state for the bucket to None when invalid data is encountered.
  • SKIP: Skip and do not process the invalid data without changing state.
  • THROW: Throw an exception and abort processing when bad data is encountered.
big_value_contextMathContext

Defines how an UpdateByOperation handles exceptionally large values it encounters. The default value is DECIMAL128. The following values are available:

  • DECIMAL128: IEEE 754R Decimal128 format. 34 digits and rounding is half-even.
  • DECIMAL32: IEEE 754R Decimal32 format. 7 digits and rounding is half-even.
  • DECIMAL64: IEEE 754R Decimal64 format. 16 digits and rounding is half-even.
  • UNLIMITED: Unlimited precision arithmetic. Rounding is half-up.

Returns

An instance of an OperationControl class that can be used in an update_by operation.

Examples

The following example does not set op_control, and thus uses the default settings of BadDataBehavior.SKIP and MathContext.DECIMAL128. Null values in the source table are skipped.

The following example sets op_control to use BadDataBehavior.RESET when null values occur, so that the EMA is reset when null values are encountered.

The following example sets op_control to use BadDataBehavior.RESET when NaN values occur, so that the EMA is reset when NaN values are encountered.

The following example sets op_control to use BadDataBehavior.POISON when NaN values occur. This results in the EMA being poisoned with NaN values.

The following example sets op_control to BadDataBehavior.THROW when null values occur. The query throws an error when it encounters a null value in the first row.