Question

I would like to query a list of values from the database, then use it as input for my custom C++ UDF.

The idea being that I'd grab the mapping from the database when the query started. This is the part I don't know how to do from within C++.

SELECT 'foo',val ...

Then the return value of my custom_scalar_func, I could map the similar names and derive my new value.

SELECT custom_scalar_func(some_other_val,'foo') ...
Was it helpful?

Solution

Heard back from their support, Vertica does not support being able to run queries from within a UDx.

OTHER TIPS

A mandatory requirement is to have Vertica SDK.
Also, it is highly recommneded you will have the Vertica documentation,
especially Programmer's Guide and SDK doumnetation.
Both of them can be downloaded from here (after registration):
https://my.vertica.com
Additional great source would be the Vertica contributed packages located in github here:
Vertica github home page
I found great example of SUDF (Scalar User Defined Function) in here:
Vertica Scalar word count function

According to the Vertica documentation:
"You create your UDSF by subclassing two classes defined by the Vertica SDK: Vertica::ScalarFunction and Vertica::ScalarFunctionFactory."
This is the basic, I think after you look at the link above (wordcount), you will understand how it works.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top