In my R function, I am trying to connect to Vertica using RODBC.
$cat sample.R
sample <- function(test)
{
library(RODBC)
myconn <-odbcConnect("SFPDSN")
pundat <- sqlQuery(myconn, "select * from test_super;")
return(1)
}
sampleFactory <- function()
{
list(name=sample ,udxtype=c("transform"),intype=c("int"),outtype=c("int"))
}
"sqlQuery" is working when I execute these staments in R. But when I run my R function in Vertica it gives me error.
dbadmin=> \i sam.sql
Drop library sampleLib cascade;
DROP LIBRARY
CREATE LIBRARY sampleLib AS '/home/dbadmin/sample.R' LANGUAGE 'R';
CREATE LIBRARY
CREATE TRANSFORM FUNCTION sample AS NAME 'sampleFactory' LIBRARY sampleLib;
CREATE TRANSFORM FUNCTION
vsql:sam.sql:7: ERROR 3399: Failure in UDx RPC call InvokeProcessPartition(): Error calling processPartition() in User Defined Object [sample] at [/scratch_a/release/vbuild/vertica/UDxFence/RInterface.cpp:1236], error code: 0, message: Exception in processPartitionForR: [first argument is not an open RODBC channel]
dbadmin=>
Below statement are working fine in R.
>library(RODBC)
>myconn <-odbcConnect("SFPDSN")
>pundat <- sqlQuery(myconn, "select * from test_super;")
Where "SFPDSN" is the odbc connection.
Sign up
Already have an account? Login
Welcome to the Rocket Forum!
Please log in or register:
Employee Login | Registration Member Login | RegistrationEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.