LucidDB / luciddb

DEFUNCT: See README
https://github.com/LucidDB/luciddb
Apache License 2.0
52 stars 24 forks source link

[FRG-47] casting of decimals in a case statement fails if not exactly matching P,S #823

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[reporter="schoi", created="Thu, 16 Feb 2006 18:46:31 -0500 (GMT-05:00)"] Repro:
----------
create schema s;
set schema 's';

create table n1 (d decimal(2,1) primary key, d2 decimal(2,1));
insert into n1 values(1.2, null);

select d2, (case when d2 is null then 0.0 else d end) from n1;

+-----+---------+
| D2 | EXPR$1 |
+-----+---------+
| | 0.0 |
+-----+---------+


select d2, (case when d2 is null then 0 else d end) from n1;

output:
-------------
Error: CALL castA(s8,s4) not registered (at line:col 0:-1860292672 to 13:29, characters 0 to 335) (state=,code=0)
net.sf.farrago.util.FarragoUtil$FarragoSqlException: CALL castA(s8,s4) not registered (at line:col 0:-1860292672 to 13:29, characters 0 to 335)
        at net.sf.farrago.resource.FarragoResource$_Def0.ex(FarragoResource.java:1187)
        at net.sf.farrago.fennel.FennelDbHandle.handleNativeException(FennelDbHandle.java:321)
        at net.sf.farrago.fennel.FennelDbHandle.executeCmd(FennelDbHandle.java:252)
        at net.sf.farrago.runtime.FarragoRuntimeContext.prepareStreamGraph(FarragoRuntimeContext.java:542)
        at net.sf.farrago.runtime.FarragoRuntimeContext.access$200(FarragoRuntimeContext.java:58)
        at net.sf.farrago.runtime.FarragoRuntimeContext$1.initializeEntry(FarragoRuntimeContext.java:433)
        at net.sf.farrago.util.FarragoObjectCache.pin(FarragoObjectCache.java:157)
        at net.sf.farrago.runtime.FarragoRuntimeContext.loadFennelPlan(FarragoRuntimeContext.java:453)
        at net.sf.farrago.query.FarragoExecutableJavaStmt.execute(FarragoExecutableJavaStmt.java:114)
        at net.sf.farrago.db.FarragoDbStmtContext.execute(FarragoDbStmtContext.java:272)
        at net.sf.farrago.jdbc.engine.FarragoJdbcEngineStatement.execute(FarragoJdbcEngineStatement.java:106)

dynamobi-build commented 12 years ago

[author="angel", created="Sat, 18 Feb 2006 22:19:16 -0500 (GMT-05:00)"] Fixed in eigenbase dt change 5509. Leaving it open so John can review the changes and confirm that it is fixed.

dynamobi-build commented 12 years ago

[author="jvs", created="Wed, 19 Apr 2006 12:25:31 -0500 (GMT-05:00)"] Verified that fix works. JohnP, could you review Angel's changes and mark this resolved if they're OK?

dynamobi-build commented 12 years ago

[author="jpham", created="Sat, 29 Apr 2006 12:49:20 -0500 (GMT-05:00)"] I made a few changes to handle more complex cases:

values case when true then 123 else 10.5 end;
values case when true then 10.35 else 1.234 end;

values case when true then null else 10.35 end;
values case when true then 10.35 else null end;

values case when true then 10.35 else 1.5e3 end;
values case when true then 1.5e3 else 10.35 end;

There are still some oustanding issues with the Java calc
implementation of case statements. I filed this as FRG-116.