Registering the Impala UDFs

  1. Log in to the master node with a user account having permissions to create and drop UDFs.

  2. To navigate to the directory that contains the helper script, run the following command:

    cd /opt/cloudera/parcels/PTY_BDP/pepimpala/sqlscripts
    
  3. To create the UDFs using the helper script, run the following command:

    impala-shell -i node1 -k -f createobjects.sql
    
  4. Press ENTER.

    The script creates all the required user-defined functions for Impala.

    Starting Impala Shell with Kerberos authentication using Python 2.7.18
    Using service name 'impala'
    Warning: live_progress only applies to interactive shell sessions, and is being skipped for now.
    Opened TCP connection to node1:21000
    Connected to node1:21000
    Server version: impalad version 4.0.0.7.1.8.0-801 RELEASE (build a3b56f90d9c31ebfa5ce3c266700284a420db28f)
    Query: ---------------------------------------------------------------------
    -- Protegrity DPS User Defined Functions.
    -- Copyright (c) 2014 Protegrity USA, Inc. All rights reserved
    --
    -- This script must be run by user that has 'superuser' privilegies.
    ---------------------------------------------------------------------
    
    
    CREATE FUNCTION pty_getversion() RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_getversion'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 1.51s
    Query: CREATE FUNCTION pty_getversionextended() RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_getversionextended'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.22s
    Query: CREATE FUNCTION pty_whoami() RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_whoami'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_stringenc(STRING, STRING) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_stringenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_stringdec(STRING, STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_stringdec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.23s
    Query: CREATE FUNCTION pty_stringins(STRING,STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_stringins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.19s
    Query: CREATE FUNCTION pty_stringsel(STRING, STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_stringsel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_unicodestringins(STRING,STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_unicodestringins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.14s
    Query: CREATE FUNCTION pty_unicodestringsel(STRING,STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_unicodestringsel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_unicodestringfpeins(STRING,STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_unicodestringfpeins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.14s
    Query: CREATE FUNCTION pty_unicodestringfpesel(STRING,STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_unicodestringfpesel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_integerenc(INTEGER, STRING ) RETURNS STRING
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_integerenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.23s
    Query: CREATE FUNCTION pty_integerdec(STRING, STRING ) RETURNS INTEGER
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_integerdec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_integerins(INTEGER, STRING ) RETURNS INTEGER
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_integerins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.15s
    Query: CREATE FUNCTION pty_integersel(INTEGER, STRING ) RETURNS INTEGER
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_integersel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_doubleenc(double, STRING ) RETURNS string
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_doubleenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.15s
    Query: CREATE FUNCTION pty_doubledec(STRING, STRING ) RETURNS double
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_doubledec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.14s
    Query: CREATE FUNCTION pty_doubleins(double, STRING ) RETURNS double
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_doubleins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_doublesel(DOUBLE, STRING ) RETURNS DOUBLE
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_doublesel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.14s
    Query: CREATE FUNCTION pty_floatenc(float, STRING ) RETURNS string
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_floatenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_floatdec(STRING, STRING ) RETURNS float
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_floatdec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_floatins(float, STRING ) RETURNS float
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_floatins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_floatsel(float, STRING ) RETURNS float
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_floatsel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_smallintenc(smallint, STRING ) RETURNS string
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_smallintenc'  prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_smallintdec(STRING, STRING ) RETURNS smallint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_smallintdec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_smallintins(smallint, STRING ) RETURNS smallint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_smallintins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_smallintsel(smallint, STRING ) RETURNS smallint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_smallintsel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_bigintenc(bigint, STRING) RETURNS string
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_bigintenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_bigintdec(STRING, STRING) RETURNS bigint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_bigintdec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_bigintins(bigint, STRING) RETURNS bigint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_bigintins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_bigintsel(bigint, STRING) RETURNS bigint
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_bigintsel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_dateenc(date, STRING ) RETURNS string
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_dateenc' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.12s
    Query: CREATE FUNCTION pty_datedec(STRING, STRING ) RETURNS date
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_datedec' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_dateins(date, STRING ) RETURNS date
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_dateins' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.13s
    Query: CREATE FUNCTION pty_datesel(date, STRING ) RETURNS date
    LOCATION '/opt/protegrity/impala/udfs/pepimpala3_4_RHEL.so'
    SYMBOL = 'pty_datesel' prepare_fn='UdfPrepare' close_fn='UdfClose'
    +----------------------------+
    | summary                    |
    +----------------------------+
    | Function has been created. |
    +----------------------------+
    Fetched 1 row(s) in 0.14s
    

Last modified : February 20, 2026