When I call Linear Regression function of R on the data set I get an error message stating
Could not execute 'CALL ANAGAPPAN.USE_LM("POWER_CONSUMPTION","POWER_CONSUMPTION_OUT") WITH OVERVIEW' in 280 ms 668 µs . SAP DBTech JDBC: [2048]: column store error: search table error: [34086] Convert data error: Convert Data from R to NewDB failed.;Column 'POWER_APP' not computed from R.
Code is
SELECT POWER_APP,POWER_DB,CPUTI,DBTI,DBSU,KBYTES_TRANSFERRED FROM "POWER_CONSUMPTION";
CREATE COLUMN TABLE "POWER_CONSUMPTION_OUT" LIKE "POWER_CONSUMPTION" WITH DATA;
DROP PROCEDURE USE_LM;
CREATE PROCEDURE USE_LM(IN train "POWER_CONSUMPTION",OUT result "POWER_CONSUMPTION_OUT")
LANGUAGE RLANG AS
BEGIN
model_app <- lm( POWER_APP ~ CPUTI + DBTI + DBSU + KBYTES_TRANSFERRED, data = train )
PREDICTIVE_ANALYSIS <- predict(model_app)
result <-as.data.frame(PREDICTIVE_ANALYSIS)
END;
CALL ANAGAPPAN.USE_LM("POWER_CONSUMPTION","POWER_CONSUMPTION_OUT") WITH OVERVIEW;
SELECT*FROM "POWER_CONSUMPTION";
Have gone through the SAP HANA R Integration Guide, the example here works. Have checked calling in a standalone Rstudio with the data set it worked too, but when it comes to calling the function of R within SQL to the Rserver it fails.