company
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
SAP HANA supports this type of sidecar deployment<br />
to offer data scientists the ultimate flexibility<br />
to use any algorithm they want or even create<br />
their own in R. They call R scripts through<br />
SQLScript in SAP HANA and then pass the scripts<br />
to an external R server, along with all of the<br />
required input data. The results are sent back to<br />
SAP HANA and combined with any local data<br />
required to complete the query (see Figure 12).<br />
However, integrating the results from arbitrary<br />
scripting code using an external server results in<br />
significant overhead required to extract and<br />
transfer data to the R server for processing. Performing<br />
all calculations with a local in-memory<br />
predictive engine, such as the PAL for SAP HANA,<br />
avoids this overhead.<br />
PREDICTIVE ANALYSIS LIBRARY: PAL<br />
The predictive analysis library, or PAL, is designed<br />
to take advantage of the ability of SAP HANA to<br />
host execution engines and perform local calculations<br />
in memory. Unlike the previous option that<br />
uses an external predictive server for processing,<br />
this SAP HANA–native library enables users to<br />
perform in-database data mining and statistical<br />
calculations with excellent performance on large<br />
data sets.<br />
Figure 12: Sample Code in SQLScript<br />
/*Create a function using input and output<br />
table types in HANA*/<br />
CREATE FUNCTION LR( IN input1 SUCC_PREC_TYPE,<br />
OUT<br />
output0 R_COEF_TYPE)<br />
LANGUAGE RLANG AS’’’<br />
CHANGE_FREQ