Create R function that can be applied to an entire table

Willem Ligtenberg willem.ligtenberg at openanalytics.eu
Wed Apr 6 21:45:26 CEST 2016


Hi,

I guess I am pushing the user defined R functions to their limits.
I know want to implement some batch correcting in R and then apply that to an entire table.
I have written R code, that will generate a function definition that has matching parameters.
And then I want to call the function as follows:

CREATE TABLE data_bc AS SELECT * FROM batch_correction( (SELECT * FROM data) ) WITH DATA;

I then get the following error:
Error in .local(conn, statement, ...) : 
  Unable to execute statement 'CREATE TABLE hcs_batch AS SELECT * FROM batch_correction( (SELECT * FROM hcs_norm) ) WITH DATA;'.
Server says '!Command too large'

Looking at the source, this error is raised in rapi.c
on either line 467 or 473.

After editing the source to figure out which of the lines was triggered, I figured out is was on line:
467 it is triggered, so the following code raises the issue that the command is too large:

        pos = 0;
        for (i = pci->retc + 2; i < pci->argc && pos < sizeof(argnames); i++) {
                pos += snprintf(argnames + pos, sizeof(argnames) - pos, "%s%s",
                                                args[i], i < pci->argc - 1 ? ", " : "");
        }
        if (pos >= sizeof(argnames)) {
                msg = createException(MAL, "rapi.eval", "Command too large1");
                goto wrapup;
        }

(yes, I added the 1 to large, to make it unique)

If this is not a bug, any help in getting my code to work is greatly appreciated.

Kind regards,

Willem


More information about the users-list mailing list