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

Unhandled Query Planning Failure when working with a VALUES query with a column full of NULLs when there is also other processing happening. #16456

Open
vogievetsky opened this issue May 15, 2024 · 0 comments

Comments

@vogievetsky
Copy link
Contributor

The SQL data loader in the web console uses a VALUES query to make a sample dataset for easy previewing. I know the description might make this sounds like a crazy corner case but in actuality this is a very common thing to stumble upon as in a sample of data (20 rows or so) with many column you are very likely to get a column that is all NULL.

Affected Version

All recent Druid versions that I tested including the latest build on master as of this writing and 30.0.0 RC.

Description

Here is a very simple (self contained) query that fails:

SELECT
  CAST("c1" AS VARCHAR) AS "channel",
  CAST("c2" AS VARCHAR) AS "cityName",
  PARSE_JSON("c3") AS "j"
FROM (
  VALUES
  ('ca', NULL, '{}'),
  ('de', NULL, '{"a":"1"}'),
  ('de', null, '{"a":"2"}')
) AS "t" ("c1", "c2", "c3")
image

All that is logged in the broker is:

2024-05-15T18:43:43,102 WARN [sql[8f567aa7-38c4-4d27-89dc-60189e66f5c9]] org.apache.druid.sql.http.SqlResource - Exception while processing sqlQueryId[8f567aa7-38c4-4d27-89dc-60189e66f5c9] (org.apache.druid.error.DruidException: Unhandled Query Planning Failure, see broker logs for details)

Which is not helpful

Curiously if one of the NULLs is changed to, say a '' it works:

image

Also if we remove the PARSE_JSON it also works:

image

From playing around with this it appears that there is some additional processing step that applying a function like PARSE_JSON adds that can not handle a NULL typed column that is being cast.

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

No branches or pull requests

1 participant