creating R UDF library


Ima getting error while running library in vertica  , though the underlying Rcode is exceuting fine in R (no syntax errors) 

Failure in UDx RPC call InvokeSetExecContext(): Error calling setupExecContext() in User Defined Object [] at [/scratch_a/release/22925/vbuild/vertica/OSS/UDxFence/vertica-udx-R.cpp:139], error code: 0, message: Exception in Validate Library:<text>:1:29: unexpected input

1: rudfkmeans <- function(x,y)


  • Hi kr,


    Can you share the code that is causing the error? I think you have  a syntax error in your code. It may be syntactically correct in R, but Vertica does some additional validation on the R source before running it.




  • I'm having the same issues, I have tried many different versions and still get the same error.


    Attaching the code, can you please take a look and point me to what I'm doing wrong:


    DetectSeasonality <- function(x,y)
    ifelse(!is.null(y[['TimeInterval']]),TimeInterval = as.numeric(y[['TimeInterval']]),stop("Expected parameter TimeInterval"))
    ifelse(!is.null(y[['SmoothingMethod']]),SmoothingMethod = as.character(y[['SmoothingMethod']]),stop("Expected parameter SmoothingMethod"))
    ifelse(!is.null(y[['alpha']]),alpha = as.numeric(y[['alpha']]),stop("Expected parameter alpha"))
    ifelse(!is.null(y[['beta']]),beta = as.numeric(y[['beta']]),stop("Expected parameter beta"))
    ifelse(!is.null(y[['LowValues']]),LowValues = as.numeric(y[['LowValues']]),stop("Expected parameter LowValues"))
    ifelse(!is.null(y[['CutIntervals']]),CutIntervals = as.numeric(y[['CutIntervals']]),stop("Expected parameter CutIntervals"))
    dataResult = FindSeasonality(x,TimeInterval,SmoothingMethod,alpha,beta,LowValues,CutIntervals)
    FindSeasonalityParams <- function()
    params = data.frame(datatype=c('int','varchar','int','int','int','int'), length=rep(NA,6), scale=rep(NA,6), name=c("TimeInterval","SmoothingMethod","alpha","beta","LowValues","CutIntervals"))
    DetectSeasonality_factory = function()




  • We have typically seen this error whenever the R script is created in Windows OS and saved in the Dos/Windows format instead of Unix format(End of Line character is different). We usually open the file in Notepad++ and use "Edit --> EOL Conversion" to save the source file in Unix format. 



  • Hi,


    That fixed the issue.


    Thank you very much.

Leave a Comment

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