You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@storm.apache.org by Susana González <su...@gmail.com> on 2014/10/14 16:11:23 UTC

How to define integers in Storm - Esper?

Hi,

I'm using storm-esper and want to have the following EPL statement where
the filtering is based on a threshold integer value:

*insert into OutputEvent select * from myEvent where (userdata2 > 0)*

I know Storm uses by default the type Object and Esper requires to know the
event type in advance in the statements, so I've defined in the EsperBolt
the type hint in this way (following the instructions in
https://github.com/tomdz/storm-esper ):



*   .inputs()                .aliasComponent("schemaBolt")
    .withField("userdata2").*
*ofType(Integer.class)                    .toEventType("myEvent")*

But when I run it and send an event, I get the following error:

*java.lang.RuntimeException: com.espertech.esper.client.**EPException:
java.lang.ClassCastException: java.lang.String cannot be cast to
java.lang.Number*

I've also tried using cast(userdata2,int) with the same failed result:

*2014-10-14 14:57:43 c.e.e.f.ExprNodeAdapterBase [ERROR] Error evaluating
expression 'cast(userdata2,int)>0' statement 'OutputEvent':
java.lang.String cannot be cast to java.lang.Number*

I think that maybe is because the tuples are emited by the schemaBolt in an
Object[]:


*Object[] fields=new Object[longSchemaNames];_collector.emit(new
Values(fields));*
Any idea about how to solve it? How could I define some fields in the tuple
emitted by Storm as integer (or float) to compare with a threshold in an
Esper statement?

Thanks in advance!!