Options

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)

Comments

  • Options

    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.

     

    Thanks,

    Chris

  • Options

    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)
    {
    library('AnomalyDetection')
    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)
    dataResult
    }
    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"))
    params
    }
    DetectSeasonality_factory = function()
    {
    list(name=DetectSeasonality,udxtype=c("transform"),intype=c("any"),outtype=c("any"),parametertypecallback=FindSeasonalityParams)
    }

    Thanks,

     

    Kostia

  • Options

    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. 

     

    Ravi

  • Options

    Hi,

     

    That fixed the issue.

     

    Thank you very much.

Leave a Comment

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