Search code examples
espernesper

Cant use user defined function return value in where clause


I have a UDF in Esper which returns an int

getVal(int val){
//doing stuff
return val;
}

if i do this

select getVal(eventAttribute) from Event

it returns

{getVal(eventAttribute)=3 } //3 example could be anything

However if i specify

select getVal(eventAttribute) from Event WHERE getVal(eventAttribute) = 3

the listener wont update

Does anyone know why? Do I have to set the attribute in the Event class? since it updates from the select clause but with a WHERE clause even though it returns an int = 3

EDIT:

insert into Stream select getVal(attribute) as value

select value from Stream where value > 3

This works.


Solution

  • Are you sure that "getVal" always returns the same value for a given "eventAttribute" and "eventAttribute" is immutable? If yes provide some test code to reproduce?