Skip to Content
0
Former Member
Sep 02, 2016 at 05:19 PM

How to Profiling R Procedures with Rprof

96 Views

Hello experts,

I want to profile R procedures with "Rprof". According to the example in SAP HANA R Integration Guide, I executed the following code:

DROP TABLE "Rprof";

CREATE COLUMN TABLE "Rprof"("function" VARCHAR(5000), "total.time" DOUBLE, "total.pct" DOUBLE, "self.time" DOUBLE, "self.pct" DOUBLE);

DROP TYPE DUMMY_2;

CREATE TYPE DUMMY_2 AS TABLE(

VAL DOUBLE

);

DROP PROCEDURE USE_RPROF;

CREATE PROCEDURE USE_RPROF(OUT result "Rprof", OUT result2 DUMMY_2)

LANGUAGE RLANG AS

BEGIN

tmp <- tempfile()

Rprof(tmp)

addition <- function(a,b,c){

d <- a * b + c - a;

};

result2 <- addition(5,7,5);

Rprof(NULL)

profile <- as.data.frame(summaryRprof(tmp)$by.total)

unlink(tmp)

result <- cbind("function"=rownames(profile), profile)

END;

CALL USE_RPROF(?,?);

SELECT * FROM "Rprof";

Then I receive the Error:

Could not execute 'CALL USE_RPROF(?,?)' in 408 ms 404 µs .

SAP DBTech JDBC: [2048]: column store error: search table error: [34084] Receive error: get result error.;The response message type mismatch

If I delete the function "addition()" in these code, instead of the simple code:

BEGIN

tmp <- tempfile()

Rprof(tmp)

a <- 5;

b <- 6;

a+b;

Rprof(NULL)

profile <- as.data.frame(summaryRprof(tmp)$by.total)

unlink(tmp)

result <- cbind("function"=rownames(profile), profile)

END;

CALL USE_RPROF(?);

SELECT * FROM "Rprof";

Then it could be successfully executed, but with no any record caught in the consequent table. I wonder where is the problem?

Attachments