The UDF simulator is invoked via a Python script packaged with the native
Python API, at:
examples/udfsim.py.
Though the script is distributed with the Python API, you can also use it
when developing a UDF in C++.Modes
Execute Parameters and Flags
Output Parameters and Flags
Usage
-
Run the simulator with the
executeargument and any parameters. Once finished, it prints an export command that sets the environment variable needed for the UDF API: -
Run the printed
exportcommand via command line: -
Execute the UDF. For example, executing a Python UDF script:
-
Optionally, run the simulator with the
outputargument and any parameters to output data from the UDF into the database:This mode requires the environment variable output from step 2 to be set -
Optionally, run the simulator with the
cleanargument to clean up all the files written in step 2. The files can also be manually deleted if desired:This mode requires the environment variable output from step 2 to be set
Examples
Running the UDF simulator for the Python table copy UDF with the following parameters/flags:- in distributed mode
- using the
udf_tc_in_tabletable as input andudf_tc_out_tabletable as output (both tables created using Python table copy manager script), - placing all control files in
/tmp/data/udf-sim-test/ - performing a dry run on the
outputmode
Limitations
The UDF simulator has some limitations:- When simulating a distributed UDF, all the data from the input table goes to one place and the UDF isn’t run in parallel
- Input data is written to actual files, not memory maps, so reading it from within the UDF may be slower and therefore I/O performance testing is not possible