You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "pjain1 (via GitHub)" <gi...@apache.org> on 2024/11/20 09:02:55 UTC

[I] Union Query with Join throws error (druid)

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

   Have been trying to use a right join query with unioned datasource to achieve sort of null filling since timeseries have limited support for returning empty buckets (like it just fills missing buckets within segment's actual min and max time not the query min and max times) but it fails. 
   
   ### Affected Version
   
   29.0.1
   
   ### Description
   
   ```
   SELECT "t2"."hour", "t1"."Count" FROM (
     (SELECT TIME_FLOOR("__time", 'PT1H') AS "hour",
       COUNT(*) AS "Count"
       FROM "inline_data_day" GROUP BY 1) "t1"
     RIGHT JOIN (
       SELECT CAST('2023-10-10T00:00:00.000Z' as TIMESTAMP) as "hour"
       UNION ALL 
       SELECT CAST('2023-10-10T01:00:00.000Z' AS TIMESTAMP) as "hour"
       UNION ALL 
       SELECT CAST('2023-10-10T02:00:00.000Z' AS TIMESTAMP) as "hour"
     ) "t2" 
     ON "t1"."hour"="t2"."hour"
   )
   
   ```
   This fails with 
   ```
   Query could not be planned. A possible reason is [SQL requires union with input of a datasource type that is not supported. Union operation is only supported between regular tables. ]
   ```
   
   inline_data_day is just
   ```
   __time	                        v	count
   2023-10-10T00:00:00.000Z	a	1
   2023-10-10T02:00:00.000Z	b	2
   2023-10-11T00:00:00.000Z	a	1
   2023-10-11T02:00:00.000Z	b	2
   ```


-- 
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: commits-unsubscribe@druid.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org