Hi,

May I know the meaning of IS [NOT] NULL for a complex type such as STRUCT?
As far as I know, we cannot assign NULL to struct directly.
So, I expected them:
1) NULL returns if any of the elements in struct has NULL
2) NULL returns if all of the elements in struct have NULL

By the way, my assumption was wrong in my example below. Could you let me
know when struct is null?

For example,
create table t1(a struct<c1:int, c2:string, c3:double>);
insert into t1 select named_struct('c1', 100, 'c2', 'test', 'c3', 1.234);
insert into t1 select named_struct('c1', cast(null as int), 'c2', 'test',
'c3', 1.234);
insert into t1 select named_struct('c1', 100, 'c2', cast(null as string),
'c3', 1.234);
insert into t1 select named_struct('c1', 100, 'c2', 'test', 'c3', cast(null
as double));
insert into t1 select named_struct('c1', cast(null as int), 'c2', cast(null
as string), 'c3', cast(null as double));
select a is null, * from t1;
false   {"c1":100,"c2":"test","c3":1.234}
false   {"c1":null,"c2":"test","c3":1.234}
false   {"c1":100,"c2":null,"c3":1.234}
false   {"c1":100,"c2":"test","c3":null}
false   {"c1":null,"c2":null,"c3":null}

Best regards,
Jinchul

Reply via email to