AE environment variables and register_ae

Based on the arguments specified, register_ae sets a number of system AE environment variables.

The behavior of the AE process is controlled by these variables, which include executable path, command-line arguments, logging options, paths, and so on. To see which variables are set by an invocation of register_ae, use the --echo option.

--echo
Displays how the compile template is expanded. See the nzsql show output in the --environment description for an example of --echo results.
--environment <variable>
Sets an AE system or user-specific environment variable. You can override the environment variables set by register_ae, use advanced AE registration variables that are not supported by register_ae, and set user-specific environment variables.
Note: The starting substring “NZAE” is reserved for AE system environment variables and should not be used for user-specific variables.
User-specific variable example:
--environment "'APPLY_INFO'='true'"

The full power of AEs is available through the AE system environment variables. For more information, see Introducing AE environment variables.

When a function is registered, you can display the effects of the –environment options (and many other NPS system SQL function settings) by using the SQL show command. A table function that calls a Java AE is registered in the following example:
register_ae
--language java
--template udtf
--version 3
--sig "applyOperationV2Tf(varargs)"
--return "table(result double)"
--define java_class=org.netezza.education.ApplyDriverV2 --
level 1
--environment "'APPLY_FUNCTION'='OPERATION'"
Running show in nzsql produces the following example:
SHOW FUNCTION applyOperationV2Tf;
RESULT | FUNCTION | BUILTIN | ARGUMENTS
--------------------------------+--------------------+---------+---
TABLE(RESULT DOUBLE PRECISION) | APPLYOPERATIONV2TF | f | ()
Use the verbose option to display additional information. In addition to using the show command, you can run register_ae with the --echo option to display this output. To fully understand the output, see Introducing AE Environment Variables. Below are the AE environment variables from the applyOperationV2Tf example:
SHOW FUNCTION applyoperationV2TF VERBOSE;
APPLY_FUNCTION=OPERATION
NZAE_REGISTER_NZAE_DYNAMIC_ENVIRONMENT=0
NZAE_REGISTER_NZAE_EXECUTABLE_PATH=
/nz/export/ae/languages/java/6.13.0/jdk1.6.0_13/bin/java
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_DEBUG=1
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_PREPEND_LD_LIBRARY_PATH=
/nz/export/ae/adapters/java/3/sys/nz/lib/host
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE =0
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE_LAUNCH_VERBOSE=0
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE_NAME=
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE_NAME_DATA_SLICE=0
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE_NAME_SESSION=0
NZAE_REGISTER_NZAE_HOST_ONLY_NZAE_REMOTE_NAME_TRANSACTION=0
NZAE_REGISTER_NZAE_LOG_IDENTIFIER=applyOperationV2Tf(varargs)
NZAE_REGISTER_NZAE_NUMBER_PARAMETERS=1
NZAE_REGISTER_NZAE_PARAMETER1=org.netezza.education.ApplyDriverV2
NZAE_REGISTER_NZAE_PREPEND_CLASSPATH=
/nz/export/ae/applications/dev/admin/java/:
/nz/export/ae/applications/dev/admin/java:
/nz/export/ae/adapters/java/3/sys/nz/java/nzae.jar
NZAE_REGISTER_NZAE_PREPEND_PATH=
/nz/export/ae/languages/java/6.13.0/jdk1.6.0_13/bin
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_DEBUG=1
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_PREPEND_LD_LIBRARY_PATH=
/nz/export/ae/adapters/java/3/sys/nz/lib/spu10
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE =0
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE_LAUNCH_VERBOSE=0
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE_NAME=
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE_NAME_DATA_SLICE=0
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE_NAME_SESSION=0
NZAE_REGISTER_NZAE_SPU_ONLY_NZAE_REMOTE_NAME_TRANSACTION=0

The prefix NZAE_REGISTER is reserved for internal use by register_ae. At runtime this prefix is removed. For example, NZAE_REGISTER_NZAE_NUMBER_PARAMETERS=1 becomes NZAE_NUMBER_PARAMETERS=1.

If in this case NZAE_NUMBER_PARAMETERS was previously defined, the NZAE_REGISTER version is discarded. Thus, an AE environment variable that starts with NZAE_REGISTER can be overridden by using the register_ae --environment option. As an example, the Java registration above is changed to add a property and a command-line argument to the main Java class:
register_ae
--language java
--template udtf
--version 3 --db dev
--sig "applyOperationV2Tf(varargs)"
--return "table(result double)"
--define java_class=org.netezza.education.ApplyDriverV2 --
level 1
--environment "'APPLY_FUNCTION'='OPERATION'"
--environment "'NZAE_NUMBER_PARAMETERS'='3'"
--environment "'NZAE_PARAMETER1'='-Dmyprop=x'"
--environment "'NZAE_PARAMETER2'='org.netezza.education.ApplyDriverV2'"
--environment "'NZAE_PARAMETER3'='my parameter'"
Note: The --environment option overrides are not prefixed with NZAE_REGISTER.

You can use the register_ae ability to transform options to system AE environment variables and NPS system function settings when using AE in advanced methods and for diagnosing problems.

Unregistering environment variables set by register_ae

If a registration variable set by register_ae must be removed so that it is no longer used by the AE, use the NZAE_UNREGISTER_ prefix. For example, to remove NZAE_REGISTER_NZAE_NUMBER_PARAMETERS=0:
--environment "'NZAE_UNREGISTER_NZAE_NUMBER_PARAMETERS '='any value'"
Note: In the example, the value is irrelevant (and not required), since the variable is being removed.

Scalar Function Options

The following options are available for scalar functions only.
--nondet
Sets that this scalar function is non-deterministic. In other words, it negates the default optimization, where the NPS system assumes that for the same input a scalar function always returns the same output. In this case, the scalar function can only be invoked once for constant input instead of once per input row. For example:
--nondet
--nullcall
Negates the default NULL call behavior, allowing a scalar function that receives all NULL input to return non-NULL output. By default, the NPS system assumes that for any NULL input a scalar function always returns NULL output and thus does not invoke the scalar function. For example:
--nullcall