Can a UDx communicate back to the DB?

Moderator: NorbertKrupa

Post Reply
sarah
Intermediate
Intermediate
Posts: 77
Joined: Mon Aug 27, 2012 1:34 pm

Can a UDx communicate back to the DB?

Post by sarah » Tue Oct 13, 2015 8:00 pm

Hi guys,

Do you guys know if a UDx (either written in C++, R or Java) can communicate back to Vertica? That is, can the UDx itself connect back to the DB (i.e. using ODBC or JDVC) and get query the DB?

I found in the documentation where it says “The external procedure cannot communicate back to HP Vertica.” in the “Using External Procedures” section of the “Extending HP Vertica” document, but I can’t find any indication that a UDx cannot.

Thank you
Have a GREAT day!

scutter
Master
Master
Posts: 302
Joined: Tue Aug 07, 2012 2:15 am

Re: Can a UDx communicate back to the DB?

Post by scutter » Tue Oct 13, 2015 8:31 pm

Hi Sarah,

I haven’t written a UDx that does that, but my understanding is that a UDx can do anything that you choose to code. You would need to consider if the UDx is running across multiple partitions in parallel and how that would interract with the database.

—Sharon
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

sarah
Intermediate
Intermediate
Posts: 77
Joined: Mon Aug 27, 2012 1:34 pm

Re: Can a UDx communicate back to the DB?

Post by sarah » Wed Oct 14, 2015 3:07 am

Scutter, thank you for your response!

What do you mean by "...if the UDx is running across multiple partitions in parallel"?
Have a GREAT day!

scutter
Master
Master
Posts: 302
Joined: Tue Aug 07, 2012 2:15 am

Re: Can a UDx communicate back to the DB?

Post by scutter » Wed Oct 14, 2015 10:35 pm

Hi Sarah,

Suppose you create a UDTF and your logic for the UDTF is in the processPartition() method. You probably wouldn’t want a query to the database to occur within processPartition() because that method will be invoked for every partition of data - so potentially many times on each node.

Most UDxs have some form of parallelism, just like any operator that is running within Veritca.

The UDx framework does have a setup() method that is invoked once per instance. That might be a place where a query that only needs to be executed once could be placed. But I am speculating. I’ve written UDxs but they have been of the more typical variety where all they do is process the incoming data and send back a result set.

—Sharon
Sharon Cutter
Vertica Consultant, Zazz Technologies LLC

Post Reply

Return to “New to Vertica Database Development”