- _accumulate(self, state, row)
- Override this function to handle the accumulate process state of aggregates.
- Parameters
- state
- (list<object>) The current row of state.
- row
- (list<object>) A row of input.
This function should call setState to change the current state for the input row. The Python
value None is passed in where the database value is NULL.
- _cleanUp(self)
- Override this function for one-time cleanup of the AE.
- _finalResult(self, state)
- Override this function to handle the Finalize processing state for aggregates.
- Parameters
- state
- (list<object>) The current row of state.
- Returns
- (object) The final result of the aggregation. Return the Python value None to return NULL in the
database.
- _getFunctionResult(self, row)
- Override this to implement UDF or UDTF functionality where there is exactly one output per
input.
- Parameters
- row
- (list) The input row to the function.
- Returns
- row (list or single value) The result of the function. For UDF AEs, this must be either a list
with one value or only the value. In any case, this result must match the output signature for the
UDF/UDTF.
To output rows for a UDTF where there is not a one-to-one mapping of input to output,
override _ru- nUdtf instead of this function. The Python value None is passed in where the database
value is NULL, and None should be returned to return a NULL database value.
- _getRemoteProtocolStatus(Class)
- Override this function to provide a different status string to the remote protocol status call-
back.
- Returns
- (string) The current status of the executable.
- _handleRemoteProtocol(Class, code, data)
- Override this function to handle generic remote protocol functionality.
- Parameters
- code
- (integer) The remote protocol code identifying the remote protocol request.
- data
- (string) The remote protocol data.
- Returns
- (tuple<integer, string>) A tuple of the output code, where 0 means O K, and the return
data.
In general, an AE writer does override this function, but this capability is provided for
the advanced AE writer. Normally, an AE writer overrides one of: _getRemoteProtocolStatus ,
_handleRemoteProtocol- ControlData , _handleRemoteProtocolRequest , or
_handleRemoteProtocolStopRequest().
- _handleRemoteProtocolControlData(Class, data)
- Override this function to handle generic remote protocol control data.
- Parameters
- data
- (string) The data received from the remote protocol subsystem.
- Returns
- (string) The data to be sent to the remote protocol subsystem.
- _handleRemoteProtocolRequest(Class, request)
- Override this function to handle generic remote protocol requests.
- Parameters
- request
- (string) The request received from the remote protocol subsystem.
- Returns
- (string) The data to be sent to the remote protocol subsystem.
- _handleRemoteProtocolStopCommand(Class)
- Override this function to handle the remote protocol stop command in a non-standard way.
- The default implementation calls Class._cleanUpClass() and sys.exit().
- _initializeState(self)
- Override this function to handle the Initialize processing state for aggregates.
- _merge(self, state, inputState)
- Override this function to handle the Merge processing state for aggregates.
- Parameters
- state
- (list<object>) The current state.
- inputState
- (list<object>) The state to merge with the current state.
This function should call setState to change the current state given the input state. The
Python value None is passed in where the database value is NULL.
- _onIdle(Class)
- Override this function to handle idle time for remote AEs.
- _run(self)
- Override this function to handle generic running of AEs.
- The ability to override this function is provided for advanced AE writers. The _run function is
called for all AEs. In general, an AE writer should derive from the Ae class and override _runUdtf ,
_ru- nUdf, _runUda , _runShaper , or _runSizer as appropriate.
- _runInstance(Class, instance)
- Override this function to handle generic running of an AE instance.
- Parameters
- instance
- ( Ae ) The Ae instance to run.
This function calls _setup , _run , _cleanUp , done and close for a specified AE instance,
and handles ex- ceptions appropriately. Typically, an AE writer does not override this function, but
the capability is provided for advanced AE writers.
- _runLocal(Class)
- Override this function to handle running only local AEs.
- This function instantiates the AE and then calls _runInstance . Typically, an AE writer does not
override this function, but the capability is provided for advanced AE writers.
- _runRemote(Class)
- Override this function to handle how remote AEs are run.
- This function creates an AE remote listener, accepts requests from the Netezza software, forks
or starts a thread as appropriate, creates an instance of the AE, and calls _runInstance . It also
handles excep- tions appropriately. Typically, an AE writer does not override this function, but the
capability is provided for advanced AE writers.
- _runShaper(self)
- Override this function to handle running a shaper.
- _runSizer(self)
- Override this function to handle running a sizer.
- _runUda(self)
- Override this function to handle running an aggregate.
- In general, if the AE is an aggregate, it should override _initializeState , _aggregate(),
_merge , and _fi- nalResult . However, more fine tuning might be performed by overriding this
function instead.
- _runUdf(self)
- Override this function to handle running a UDF.
- By default, this function fetches input rows and calls _getFunctionResult . It then outputs the
result of the function call. Consequently, an AE writer can override _getFunctionResult for a
simpler interface to UDF functionality.
- _runUdtf(self)
- Override this function to handle running a UDTF.
- By default, this function fetches input rows and calls _getFunctionResult . It then outputs the
result of the function call. This function should be overridden (as compared to _getFunction- Result
) if an AE writer wants to output greater than or less than 1 row of output for each row of
input.
- _setup(self)
- Override this for one-time setup of the AE instance.
- This function is called by _runInstance immediately after creating the instance of the AE. It is
possible to override the __init__ function of the AE to perform initialization, however, it is
preferable to perform custom initialization in _setup to guarantee appropriate setup of the un-
derlying Python AE system before performing custom initialization. This provides better excep- tion
handling during custom initialization.