Error: Scalar Function produced fewer output rows than input

Moderator: NorbertKrupa

Post Reply
Expressions_Galore
Newbie
Newbie
Posts: 3
Joined: Fri Feb 22, 2013 12:49 pm
Contact:

Error: Scalar Function produced fewer output rows than input

Post by Expressions_Galore » Fri Feb 22, 2013 1:02 pm

Hi,

I have written a Scalar function for Vertica to get the polarity. Though it produces the correct output for one row input, but for inputs more than one row in length, I get the following error:

ERROR: User-defined Scalar Function <function_name> produced fewer output rows (1) than input rows (18)

The code is as follows:

Code: Select all

library("tm", lib.loc = "<path_to_lib_directory>")
library("slam", lib.loc = "<path_to_lib_directory>")
library("Rstem", lib.loc = "<path_to_lib_directory>")
library("sentiment", lib.loc = "<path_to_lib_directory>")

getSenti  <- function(comment) {
    pol   <- classify_polarity(comment);
    pol[[1,4]]
}

getSentiFactory <- function() {
    list (
        name    = getSenti,
        udxtype = c("scalar"),
        intype  = c("varchar"),
        outtype = c("varchar")
    )
}
What could be the issue? Any help would be deeply appreciated.

Thanks,
EG

Post Reply

Return to “R Language Integration”