Default
This application demonstrates how to use default function to process attributes with null values
Please see Values in Query guide for more information on format of the various data types.
define stream PatientRegistrationInputStream (
seqNo long, name string, age int,
height float, weight double, photo object,
isEmployee bool, wardNo object);
@info(name = 'SimpleIfElseQuery')
from PatientRegistrationInputStream
select
default(name, 'invalid') as name,
default(seqNo, 0l) as seqNo,
default(weight, 0d) as weight,
default(age, 0) as age,
default(height, 0f) as height
insert into PreprocessedPatientRegistrationInputStream;
|
Defines |
|
|
|
Default value of |
|
Default value of |
|
Default value of |
|
Default value of |
|
Default value of |
|
Input
An event of all null
attributes is sent to PatientRegistrationInputStream
,
Output
After processing, the event arriving at PreprocessedPatientRegistrationInputStream
will be as follows,
['invalid'
, 0
0.0
, 0
, 0.0
]
with types,
[string
, long
, double
, int
, float
]