问题
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);
Delete
siddhi-extension-event-table_3.1.2.jar
from<cep>/repository/components/plugins/
directory.Add compiled jar to
<cep>/repository/components/lib/
diectory.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