0

条件をチェックして、ストリーム内の特定の属性に値を割り当てる必要があります。

どうすればいいのですか?

例えば

人の名前が「John」で、その名前を「Peter」に変更して別のストリームに挿入する必要がある場合、どうすればよいですか?

from myStream [name == 'John']
select *
insert into outStream;
4

1 に答える 1

0
define stream myStream (name string, attribute1 int, attribute2 bool);

from myStream [name == 'John']                  --This filter matches any event with name equal to 'John'
select "Peter" as name, attribute1, attribute2  --Replaces the current name with 'Peter'
insert into outStream;

例 1

入力:

{Dilini, 123, true}

出力:

(名前がフィルタの条件 name=='John' を満たさないため、出力はありません)

例 2

入力:

{John, 123, true}

出力:

{Peter, 123, true}

Siddhiの「Query Projection」機能を参照してください。アクションを確認してください: 「デフォルト値の導入」

于 2015-11-28T17:20:41.603 に答える