Using the PythonOp operator

The operator spl.utility.PythonOp invokes an operator that is implemented in Python by using the Python Operator API. It is a general-purpose callout to Python from SPL.

A Python primitive operator has many benefits over the PythonOp operator, namely:

  • The ability to specify syntactic and semantic checks for instances of the Python code when used in a stream processing application. For example, a missing parameter can be detected only at run time when you use PythonOp . Whereas, a Python primitive can find the missing parameter at SPL compile time.
  • The Python primitive operator's name implies its function. The Python primitive operator might have an icon specific to its function for viewing graphical representations of the application.

However, spl.utility.PythonOp can be used as a development or prototyping aid to help quickly develop operators with the Python Operator API. You can understand the required parameters and libraries before you create a Python primitive operator.