LucidDB / luciddb

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

[FRG-23] Java calc implementation of CASE is eager; should be lazy #847

Closed dynamobi-build closed 12 years ago

dynamobi-build commented 12 years ago

[reporter="jvs", created="Mon, 23 Jan 2006 14:10:50 -0500 (GMT-05:00)"] Case
when x < -5 then x * 2
When x < 0 then x + 10
When x < 10 when sqrt(x) + x * 2
Else sqrt(x)
End

For a negative number, we want to make sure not to evaluate sqrt(x). But the Java calc codegen currently spits out all the possible expressions needed first, and then uses a compound if/elseif/else structure to choose the right one.

We should make sure that both the predicates (x < 10) and the return values (x + 10) are only computed if all previous branches have been skipped.

dynamobi-build commented 12 years ago

[author="xluo", created="Mon, 13 Feb 2006 21:47:19 -0500 (GMT-05:00)"] changelist 5432.