Variable Output for R polymorphic UDF

By changing the outtype value to 'ANY' in the factory function you can make the UDF return any dataset, but you must configure an output function (denoted as outtypecallback in the factory) to tell vertica the metadata of the columns.

Let me give an example. I have a UDF which takes 1 column of data (integers)

Value
   4
   2
   1

Sums the values and outputs a table with n columns filled with random numbers

n = 4+2+1 = 7

Col1   Col2   Col3   ...   Col7
   ..        ..         ..              ..

How should I write the outtypecallback function?

I know the return function takes automatically as input the metadata data frame of the input data and the parameters list if any. 

Any ideas?

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file