Hive 'is null' check problem for struct fields

Viewed 1255

Seems like there is strange behaviour for NULL checks for struct fields. Condition where some_struct_field is not null returns rows where some_struct_field actually is null.
Does anyone come acrossed this problem or have any advises how to deal with that?

Storage format: parquet
Hive version: 2.2.0

Schema looks like:

CREATE EXTERNAL TABLE IF NOT EXISTS event(
  key STRING,
  ts BIGINT,
  info STRUCT<
      id: BIGINT,
      message: BIGINT>
)
PARTITIONED BY(event_date STRING)
STORED AS PARQUET
LOCATION '/logs/events';

Query with incorrect result:

SELECT * FROM event where event_date = '20200401' and info is not null;

Query with correct result:

SELECT * FROM event where event_date = '20200401' and info.id is not null;
0 Answers
Related