[
https://issues.apache.org/jira/browse/TRAFODION-995?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Suresh Subbiah closed TRAFODION-995.
------------------------------------
> LP Bug: 1420530 - UDF: Arithmetic operations on multi-value UDFs return
> internal assertions
> -------------------------------------------------------------------------------------------
>
> Key: TRAFODION-995
> URL: https://issues.apache.org/jira/browse/TRAFODION-995
> Project: Apache Trafodion
> Issue Type: Bug
> Components: sql-exe
> Reporter: Weishiun Tsai
> Assignee: Suresh Subbiah
> Fix For: 1.1 (pre-incubation)
>
>
> Most arithmetic operations on multi-value UDFs are not allowed. But instead
> of returning a proper error, they return internal assertions in
> ../common/BaseTypes.cpp at line 118 right now.
> As shown in the 2 examples bellow, ENCRYPT_I_MVF() returns 2 integer outputs,
> and ENCRYPT_DATE_MVF() returns 2 DATE outputs. A ‘-‘ operation on
> ENCRYPT_I_MVF() and an ADD_MONTHS() operation on ENCRYPT_DATE_MVF() both
> return such internal assertions. This is seen on the v0210 build installed
> on a workstation.
> To reproduce this problem:
> (1) Download the attached tar file and untar it to get the 4 files in there.
> Put the 4 files in any directory <mydir>
> (2) Run build.sh from <mydir> to build the UDF so file.
> (3) Change the line ‘create library qa_udf_lib file '<mydir>/myudf.so'; in
> mytest.sql and fill in <mydir>
> (4) From sqlci, obey mytest.sql
> ---------------------------------------------------
> Here is the execution output:
> >>obey mytest.sql;
> >>create schema mytest;
> --- SQL operation complete.
> >>set schema mytest;
> --- SQL operation complete.
> >>
> >>create library qa_udf_lib file '<mydir>/myudf.so';
> --- SQL operation complete.
> >>
> >>create function ENCRYPT_I_MVF
> +>(INVAL int)
> +>returns (OUTVAL1 int, OUTVAL2 int)
> +>language c
> +>parameter style sql
> +>external name 'encrypt_i_mvf'
> +>library qa_udf_lib
> +>deterministic
> +>state area size 1024
> +>allow any parallelism
> +>no sql;
> --- SQL operation complete.
> >>
> >>create function ENCRYPT_DATE_MVF
> +>(INVAL date)
> +>returns (OUTVAL1 date, OUTVAL2 date)
> +>language c
> +>parameter style sql
> +>external name 'encrypt_date_mvf'
> +>library qa_udf_lib
> +>deterministic
> +>state area size 1024
> +>allow any parallelism
> +>no sql;
> --- SQL operation complete.
> >>
> >>
> >>create table myonerowtable (a int, b int);
> --- SQL operation complete.
> >>insert into myonerowtable values (6,6);
> --- 1 row(s) inserted.
> >>
> >>create table mydatetimetable (a int not null not droppable primary key,
> >>c_date date);
> --- SQL operation complete.
> >>insert into mydatetimetable values(1, date '1999-01-01');
> --- 1 row(s) inserted.
> >>
> >>select encrypt_i_mvf(a) from myonerowtable;
> OUTVAL1 OUTVAL2
> ----------- -----------
> 6 6
> --- 1 row(s) selected.
> >>select encrypt_i_mvf(a)-encrypt_i_mvf(a) from myonerowtable;
> *** ERROR[2006] Internal error: assertion failure () in file
> ../common/BaseTypes.cpp at line 118.
> *** ERROR[8822] The statement was not prepared.
> >>
> >>select encrypt_date_mvf(c_date) from mydatetimetable;
> OUTVAL1 OUTVAL2
> ---------- ----------
> 1999-01-01 1999-01-01
> --- 1 row(s) selected.
> >>select ADD_MONTHS(encrypt_date_mvf(c_date), 1, 0) from mydatetimetable;
> *** ERROR[2006] Internal error: assertion failure () in file
> ../common/BaseTypes.cpp at line 118.
> *** ERROR[8822] The statement was not prepared.
> >>
> >>drop function ENCRYPT_I_MVF;
> --- SQL operation complete.
> >>drop function ENCRYPT_DATE_MVF;
> --- SQL operation complete.
> >>drop library qa_udf_lib cascade;
> --- SQL operation complete.
> >>drop schema mytest cascade;
> --- SQL operation complete.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)