Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

string null vs null #208

Open
mmerchant opened this issue Jun 1, 2018 · 0 comments
Open

string null vs null #208

mmerchant opened this issue Jun 1, 2018 · 0 comments

Comments

@mmerchant
Copy link

Given a JSON file:

{
  "id": "1234",
  "timestamp": "2018-05-31 00:00:00",
  "foo": {
    "key1": null,
    "key2": "value"
  }
}

Using the following table create:

CREATE EXTERNAL TABLE test_table
(
    `id` string,
    `timestamp` timestamp,
    `foo` string
) ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
WITH SERDEPROPERTIES ("explicit.null"="true");

When querying using the JSON_EXTRACT_SCALAR functions the null is treated as a string "null" rather than null. For example the query below would return no results:

SELECT * FROM test_table WHERE JSON_EXTRACT_SCALAR(foo, '$.foo.key1') IS NULL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant