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);
-
Test function within call (from database console):
SELECT VLMatch(HEXTORAW('1234567890123456789012345678901234567890123456789012345678901234'), HEXTORAW('0123456789012345678901234567890123456789012345678901234567890123'), 32) FROM DUAL;
-
-- 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:
-
Install required environment. You can find more information here.
-
Install the gcc-c++ package. The package version 4.8 or higher is required.
yum -y install gcc-c++.x86_64
-
Install CMAKE. The version 3.5 or higher is required.
-
Go to the script directory:
cd /var/lib/luna/current/extras/VLMatch/vertica/
-
Change
SDK_HOME
variable (vertica sdk root) in the "makefile". The default value is/opt/vertica/sdk
. -
Run make from
/var/lib/luna/current/extras/VLMatch/vertica/
directory:make
-
Run the database console:
vsql -U luna -h 127.0.0.1 -d luna_events
-
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;
-
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".
- Check that the
USE_DB_MATCH_FUNCTION
parameter is enabled in the service settings of the Events service.