Handling null values with wso2 CEP

可紊 提交于 2019-12-24 01:44:18

问题


I want to update event table (RDBMS) using additional condition that one column in that is not null. Table name is MSISDNProfileDB and it's in oracle db.

from incomingStream#window.length(1)
select  correlation_MSISDN as MSISDN, 
        INTERACTION_DT as INTERACTION_DT
update MSISDNProfileDB
on MSISDNProfileDB.MSISDN == MSISDN
and not(MSISDNProfileDB.column1 is null);

it validates the code, but does not update INTERACTION_DT. For testing purposes, I changed it to check if the column is null, and manually remove data from column1.

from incomingStream#window.length(1)
select  correlation_MSISDN as MSISDN, 
        INTERACTION_DT as INTERACTION_DT
update MSISDNProfileDB
on MSISDNProfileDB.MSISDN == MSISDN
and MSISDNProfileDB.column1 is null;

...and it still doesnt work. But when I change column value to 1 and do this:

from incomingStream#window.length(1)
select  correlation_MSISDN as MSISDN, 
        INTERACTION_DT as INTERACTION_DT
update MSISDNProfileDB
on MSISDNProfileDB.MSISDN == MSISDN
and MSISDNProfileDB.column1 == '1';

it works! So, conclusion is that cep has problem with null values from oracle db. Does anyone knows how are null values handled?

Kind Regards, Stefan


回答1:


I came across a similar problem with MySQL. The issue seems to be in the way CEP parse Siddhi query into SQL. I did a quick fix for that, and it worked for my scenario. It should work in your case too, but haven't tested with Oracle though. To use the fix (assuming you are using CEP 4.2.0);

  1. Delete siddhi-extension-event-table_3.1.2.jar from <cep>/repository/components/plugins/ directory.

  2. Add compiled jar to <cep>/repository/components/lib/ diectory.

  3. Use following query;

    from incomingStream
    select  
        correlation_MSISDN as MSISDN, 
        INTERACTION_DT as INTERACTION_DT
    update MSISDNProfileDB
    on MSISDNProfileDB.MSISDN == MSISDN and not (MSISDNProfileDB.column1 is null);
    


来源:https://stackoverflow.com/questions/39484771/handling-null-values-with-wso2-cep

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!