Skip to main content

Vertica Extension - String Package supported in Vertica 9

  • August 10, 2018
  • 3 replies
  • 12 views

elchen

Does anyone know if the string package (https://github.com/vertica/Vertica-Extension-Packages/tree/master/strings_package) can be installed in Vertica 9?
we have a problem installed this package on Vertica 9. Appreciate your help!

3 replies

Ariel_Cary
Forum|alt.badge.img
  • Participating Frequently
  • August 10, 2018

That repo hasn't been updated in a while. It's possible you need to do a few tweaks to install the library in newer Vertica versions. What kind of error do you get?
Also, what functions are you looking to get from this library?


Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • August 10, 2018

You will need to recompile the code.

I just upgraded to Vertica 9.1.1 which came out today.

So I had to do this:

[dbadmin@s18384357 strings_package]$ pwd
/home/dbadmin/strings_package
[dbadmin@s18384357 strings_package]$ ls
build  ddl  doc  examples  lib  LICENSE.txt  Makefile  README.txt  src  test-data
[dbadmin@s18384357 strings_package]$ rm -f ./build/*
[dbadmin@s18384357 strings_package]$ rm -f ./lib/*
[dbadmin@s18384357 strings_package]$ make install
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG /opt/vertica/sdk/include/Vertica.cpp -o build/Vertica.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/EditDist.cpp -o build/EditDist.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/PorterStemmer.cpp -o build/PorterStemmer.o
src/PorterStemmer.cpp: In function ‘void step5(stemmer*)’:
src/PorterStemmer.cpp:375: warning: suggest parentheses around ‘&&’ within ‘||’
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/StringTokenizerDelim.cpp -o build/StringTokenizerDelim.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/NGrams.cpp -o build/NGrams.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/StringTokenizer.cpp -o build/StringTokenizer.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/WordCount.cpp -o build/WordCount.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/AnagramLib.cpp -o build/AnagramLib.o
g++ -g -D HAVE_LONG_LONG_INT_64 -c -I ../include -Wall -Wno-unused-value -fPIC -I /opt/vertica/sdk/include -I /home/dbadmin/strings_package/src/third-party/include -O3 -DNDEBUG src/GroupConcat.cpp -o build/GroupConcat.o
mkdir -p lib
g++ -shared -o lib/StringsLib.so build/Vertica.o build/EditDist.o build/PorterStemmer.o build/StringTokenizerDelim.o build/NGrams.o build/StringTokenizer.o build/WordCount.o build/AnagramLib.o build/GroupConcat.o
vsql -f ddl/install.sql
              version
------------------------------------
 Vertica Analytic Database v9.1.1-0
(1 row)

CREATE LIBRARY
CREATE FUNCTION
CREATE FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION
CREATE FUNCTION
CREATE TRANSFORM FUNCTION
CREATE TRANSFORM FUNCTION

Test:

[dbadmin@s18384357 strings_package]$ vsql -f ./examples/word_count.sql
CREATE TABLE
                                    sentence                                    | word_count
--------------------------------------------------------------------------------+------------
 I tried to speak Spanish, and my friend tried to speak English.                |         12
 Alejandro played football, so Maria went shopping.                             |          7
 Alejandro played football, for Maria went shopping.                            |          7
 When he handed in his homework, he forgot to give the teacher the last page.   |         15
 The teacher returned the homework after she noticed the error.                 |         10
 The students are studying because they have a test tomorrow.                   |         10
 After they finished studying, Juan and Maria went to the movies.               |         11
 Juan and Maria went to the movies after they finished studying.                |         11
 The woman who(m) my mom talked to sells cosmetics.                             |          9
 The book that Jonathan read is on the shelf.                                   |          9
 The house which Abraham  Lincoln was born in is still standing.                |         11
 The town where I grew up is in the United States.                              |         11
(12 rows)

DROP TABLE

elchen
  • Author
  • New Participant
  • August 10, 2018

Our support team just mentioned the codes cannot be compiled.

I will ask them to try Jim's suggestion. Thanks a lot!