vertica / Vertica-Extension-Packages

User Defined Extensions (UDX) to the Vertica Analytic Database
http://www.vertica.com/
Other
119 stars 113 forks source link

issue with group_concat function. #50

Closed ratheeshnellikkal closed 7 years ago

ratheeshnellikkal commented 7 years ago

Hello Team, We recently upgraded our Vertica server to the latest version to 8.0.1-0 from 7.1.2-6; We had the string packages installed in our cluster before the upgrade and it was working fine then. But after the upgrade we started getting below error when we use group_concat function. Can someone please advice how to fix this issue?

Below is the error we are getting: => select group_concat(node_name) over () from nodes; ERROR 5861: Error calling getReturnType() in User Function group_concat at [src/GroupConcat.cpp:86], error code: 0, message: Function only accepts 1 argument, but 6148914691236517207 provided

Before that we rebuilt the packages with the latest SDK; Bellow are the steps we have followed.

  1. Dropped existing function. \i uninstall.sql DROP LIBRARY
  2. Reinstall the package.

make install 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 v8.0.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

  1. Granted access to public. grant execute on transform function public.group_concat(varchar) to public;

Thanks, Ratheesh Nellikal

ratheeshnellikkal commented 7 years ago

Hello All, Following line of code was reporting the error vt_report_error(0, "Function only accepts 1 argument, but %zu provided", input_types.getColumnCount()); Looks like the input_types object is not initialized and the function getColumnCount() function was returning a garbage values.

So we had to comment out following two lines to make this code work.

     // Error out if we're called with anything but 1 argument
    // Commenting out following lines due to ERROR 5861
    //if (input_types.getColumnCount() != 1)
        //vt_report_error(0, "Function only accepts 1 argument, but %zu provided", input_types.getColumnCount());

Thanks, Ratheesh Nellikal

cjsekl commented 7 years ago

Hey,

Just tried this on v. 8.0.0 and it works fine:

              version
------------------------------------
 Vertica Analytic Database v8.0.0-2
(1 row)

dbadmin=> select group_concat(node_name) over () from nodes;
                               list
------------------------------------------------------------------
 v_warehouse_node0003, v_warehouse_node0001, v_warehouse_node0002
(1 row)

Not sure if this is something that has arisen between 8.0.0 and 8.0.1, but if it is a bug with getColumnCount it would be a problem since it's used in 14 of the extension packages.

I'll try and reproduce this on 8.0.1 when I get a chance.