vogievetsky opened a new issue, #16456:
URL: https://github.com/apache/druid/issues/16456

   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:
   
   ```sql
   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")
   ```
   
   <img width="475" alt="image" 
src="https://github.com/apache/druid/assets/177816/88821942-672a-418e-8b77-3318dd9bb734";>
   
   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:
   
   <img width="442" alt="image" 
src="https://github.com/apache/druid/assets/177816/0c4570e3-f70f-43ab-96bf-299f25b92967";>
   
   Also if we remove the `PARSE_JSON` it also works:
   
   <img width="469" alt="image" 
src="https://github.com/apache/druid/assets/177816/10019293-7c62-4e34-9bc7-e4abc4f67cee";>
   
   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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to