Uploaded image for project: 'Apache MADlib'
  1. Apache MADlib
  2. MADLIB-831

passing of composite types to UDF

    XMLWordPrintableJSON

Details

    • Request
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None

    Description

      Here is a bug that the correct value is not received when passing a composite type parameter to a UDF. The symptom can be duplicated in the following steps.

      1. define an "echo" UDF: it simply returns the first parameter it receives.

      AnyType echo::run(AnyType& args)

      { return args[0]; }

      2. define sql functions:

      echo(intvec)
      echo(array of intvec)

      where intvec is defined as (x int, y int).

      3. pass intvec and array_of_intvec to echo function:

      set search_path to public,madlib;
      select * from echo('(2,1)'::intvec); – it fails
      select * from unnest(echo(array['(2,1)'::intvec, '(3,4)'::intvec]));

      The echo(intvec) failed to received the intvec parameter: what it saw is a type of intvec with null x and y fields. On the other hand, the array_of_intvec is correct: the UDF function correctly received the parameter.

      Thanks!

      Attachments

        Activity

          People

            riyer Rahul Iyer
            opensrc krish
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: