Skip to content

VLMatch library compilation#

VLMatch for Oracle#

For VLMatch UDx function compilation one needs to:

  • Install required environment, see requirements:

  • Install the gcc/g++ 4.8 or higher

yum -y install gcc-c++.x86_64 
  • Change SDK_HOME variable - oracle sdk root (default is $ORACLE_HOME/bin, check $ORACLE_HOME environment variable is set) in the makefile.
  • Go to the directory and run the "make.sh" file:
  • cd /var/lib/luna/current/extras/VLMatch/oracle/
  • chmod +x make.sh
  • ./make.sh
  • Define the library and the function inside the database (from database console):
CREATE OR REPLACE LIBRARY VLMatchSource AS '$ORACLE_HOME/bin/VLMatchSource.so';
CREATE OR REPLACE FUNCTION VLMatch(descriptorFst IN RAW, descriptorSnd IN RAW, length IN BINARY_INTEGER)
  RETURN BINARY_FLOAT 
AS
  LANGUAGE C
  LIBRARY VLMatchSource
  NAME "VLMatch"
  PARAMETERS (descriptorFst BY REFERENCE, descriptorSnd BY REFERENCE, length UNSIGNED SHORT, RETURN FLOAT);
  1. Test function within call (from database console):

    SELECT VLMatch(HEXTORAW('1234567890123456789012345678901234567890123456789012345678901234'), HEXTORAW('0123456789012345678901234567890123456789012345678901234567890123'), 32) FROM DUAL;

  2. -- result should be "0.4765625"

VLMatch for Vertica#

You can find all the required files for the VLMatch user-defined extension (UDx) compilation in the following directory:

/var/lib/luna/current/luna-events/base_scripts/database_matching/vertica

For VLMatch UDx function compilation one needs to:

  1. Install required environment. You can find more information here.

  2. Install the gcc-c++ package. The package version 4.8 or higher is required.

    yum -y install gcc-c++.x86_64

  3. Install CMAKE. The version 3.5 or higher is required.

  4. Go to the script directory:

    cd /var/lib/luna/current/extras/VLMatch/vertica/

  5. Change SDK_HOME variable (vertica sdk root) in the "makefile". The default value is /opt/vertica/sdk.

  6. Run make from /var/lib/luna/current/extras/VLMatch/vertica/ directory:

    make

  7. Run the database console:

    vsql -U luna -h 127.0.0.1 -d luna_events

  8. Define the function inside the service database:

    CREATE OR REPLACE LIBRARY VLMatchSource AS '/opt/vertica/VLMatchSource.so'; CREATE OR REPLACE FUNCTION VLMatch AS LANGUAGE 'C++' NAME 'VLMatchFactory' LIBRARY VLMatchSource NOT FENCED;

  9. Test function within call inside the service database:

    SELECT VLMatch(HEX_TO_BINARY('1234567890123456789012345678901234567890123456789012345678901234'), HEX_TO_BINARY('0123456789012345678901234567890123456789012345678901234567890123') USING PARAMETERS descriptorLength=32);

The result must be "0.4765625".

  1. Check that the USE_DB_MATCH_FUNCTION parameter is enabled in the service settings of the Events service.
Back to top