25.10.2016 Views

SAP HANA Predictive Analysis Library (PAL)

sap_hana_predictive_analysis_library_pal_en

sap_hana_predictive_analysis_library_pal_en

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

CREATE TYPE <strong>PAL</strong>_DISTRQUANTILE_RESULT_T AS TABLE("INPUTDATA" DOUBLE, "QUANTILE"<br />

DOUBLE);<br />

DROP TYPE <strong>PAL</strong>_CONTROL_T;<br />

CREATE TYPE <strong>PAL</strong>_CONTROL_T AS TABLE(<br />

"NAME" VARCHAR (50),<br />

"INTARGS" INTEGER,<br />

"DOUBLEARGS" DOUBLE,<br />

"STRINGARGS" VARCHAR (100)<br />

);<br />

DROP TABLE <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL(<br />

"POSITION" INT,<br />

"SCHEMA_NAME" NVARCHAR(256),<br />

"TYPE_NAME" NVARCHAR(256),<br />

"PARAMETER_TYPE" VARCHAR(7)<br />

);<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL VALUES (1,<br />

'DM_<strong>PAL</strong>','<strong>PAL</strong>_DISTRQUANTILE_DATA_T', 'IN');<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL VALUES (2,<br />

'DM_<strong>PAL</strong>','<strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_T', 'IN');<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL VALUES (3, 'DM_<strong>PAL</strong>','<strong>PAL</strong>_CONTROL_T',<br />

'IN');<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL VALUES (4,<br />

'DM_<strong>PAL</strong>','<strong>PAL</strong>_DISTRQUANTILE_RESULT_T', 'OUT');<br />

CALL SYS.AFLLANG_WRAPPER_PROCEDURE_DROP('DM_<strong>PAL</strong>','<strong>PAL</strong>_DISTRQUANTILE_PROC');<br />

CALL SYS.AFLLANG_WRAPPER_PROCEDURE_CREATE('AFL<strong>PAL</strong>', 'DISTRQUANTILE',<br />

'DM_<strong>PAL</strong>','<strong>PAL</strong>_DISTRQUANTILE_PROC',<strong>PAL</strong>_DISTRQUANTILE_PDATA_TBL);<br />

DROP TABLE <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL LIKE <strong>PAL</strong>_DISTRQUANTILE_DATA_T;<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL VALUES (0.3);<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL VALUES (0.5);<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL VALUES (0.632);<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DATA_TBL VALUES (0.8);<br />

DROP TABLE <strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL LIKE<br />

<strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_T;<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL VALUES ('DistributionName',<br />

'Weibull');<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL VALUES ('Shape', '2.11995');<br />

INSERT INTO <strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL VALUES ('Scale', '277.698');<br />

DROP TABLE #<strong>PAL</strong>_CONTROL_TBL;<br />

CREATE LOCAL TEMPORARY COLUMN TABLE #<strong>PAL</strong>_CONTROL_TBL(<br />

"NAME" VARCHAR (50),<br />

"INTARGS" INTEGER,<br />

"DOUBLEARGS" DOUBLE,<br />

"STRINGARGS" VARCHAR (100)<br />

);<br />

INSERT INTO #<strong>PAL</strong>_CONTROL_TBL VALUES ('LOWER_UPPER',0,null,null);<br />

DROP TABLE <strong>PAL</strong>_DISTRQUANTILE_RESULT_TBL;<br />

CREATE COLUMN TABLE <strong>PAL</strong>_DISTRQUANTILE_RESULT_TBL LIKE <strong>PAL</strong>_DISTRQUANTILE_RESULT_T;<br />

CALL DM_<strong>PAL</strong>.<strong>PAL</strong>_DISTRQUANTILE_PROC(<strong>PAL</strong>_DISTRQUANTILE_DATA_TBL,<br />

<strong>PAL</strong>_DISTRQUANTILE_DISTRPARAM_TBL, #<strong>PAL</strong>_CONTROL_TBL,<br />

<strong>PAL</strong>_DISTRQUANTILE_RESULT_TBL) WITH OVERVIEW;<br />

SELECT * FROM <strong>PAL</strong>_DISTRQUANTILE_RESULT_TBL;<br />

Expected Result<br />

<strong>SAP</strong> <strong>HANA</strong> <strong>Predictive</strong> <strong>Analysis</strong> <strong>Library</strong> (<strong>PAL</strong>)<br />

<strong>PAL</strong> Functions P U B L I C 531

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!