You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by "benkrug (via GitHub)" <gi...@apache.org> on 2025/08/30 15:45:49 UTC

[I] requireTimeCondition can break with subqueries (druid)

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

   ### Affected Version
   
   34.0
   
   ### Description
   
   Enabling requireTimeCondition can cause some queries that use subqueries to break.  Following are two examples using wikipedia:
   
   SELECT COUNT(*)
   FROM (
     SELECT TIME_FLOOR(__time, 'PT1H'), SUM("added") AS "added"
     FROM "wikipedia"
     WHERE __time <= CURRENT_TIMESTAMP - INTERVAL 1 DAY
     GROUP BY 1
     -- HAVING added > 1
   )
   
   returns
   
   Error: RUNTIME_FAILURE (OPERATOR)
   requireTimeCondition is enabled, all queries must include a filter condition on the __time column
   org.apache.druid.sql.calcite.rel.CannotBuildQueryException
   
   If we uncomment the HAVING line, it works.  (The first way, it plans as a groupBy on a timeseries.  With the HAVING, it plans as a groupBy on a groupBy.)
   
   Another example that I've not been able to find a way to get it to run is the following:
   
   WITH sample_data AS (
     SELECT
       TIME_FLOOR("__time", 'PT5M') AS time_bucket,
       SUM(added) AS added
     FROM "wikipedia"
   WHERE "__time" > CURRENT_TIMESTAMP - INTERVAL '10' year
     GROUP BY 1
   )
   SELECT
     time_bucket AS window_end_time,
     TIME_SHIFT(time_bucket, 'PT30M', -1) AS window_start_time,
     SUM(added) OVER (
       ORDER BY time_bucket
       ROWS BETWEEN 5 PRECEDING AND CURRENT ROW
     ) AS rolling_volume
   FROM sample_data
   
   (This plans with a timeseries, a scan, and a windowOperator query.)
   
   It seems that the planner could be smarter about whether a time interval is being provided where it matters.


-- 
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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #18461:
URL: https://github.com/apache/druid/issues/18461#issuecomment-4920464231

   This issue has been closed due to lack of activity. If you think that
   is incorrect, or the issue requires additional review, you can revive the issue at
   any time.


-- 
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

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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "JRobTS (via GitHub)" <gi...@apache.org>.
JRobTS commented on issue #18461:
URL: https://github.com/apache/druid/issues/18461#issuecomment-3246270836

   Note that these queries worked with the requireTimeCondition in version 29.0.1


-- 
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

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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "JRobTS (via GitHub)" <gi...@apache.org>.
JRobTS commented on issue #18461:
URL: https://github.com/apache/druid/issues/18461#issuecomment-3245205794

   In general, the queries that break on requireTimeCondition seems to vary from release to release. We could really do with some automated regression tests.


-- 
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

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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #18461: requireTimeCondition can break with subqueries
URL: https://github.com/apache/druid/issues/18461


-- 
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

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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #18461:
URL: https://github.com/apache/druid/issues/18461#issuecomment-4665504195

   This issue has been marked as stale due to 280 days of inactivity.
   It will be closed in 4 weeks if no further activity occurs. If this issue is still
   relevant, please simply write any comment. Even if closed, you can still revive the
   issue at any time or discuss it on the dev@druid.apache.org list.
   Thank you for your contributions.


-- 
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

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


Re: [I] requireTimeCondition can break with subqueries (druid)

Posted by "JRobTS (via GitHub)" <gi...@apache.org>.
JRobTS commented on issue #18461:
URL: https://github.com/apache/druid/issues/18461#issuecomment-4960271743

   Is `requireTimeCondition` an abandoned feature? :'(


-- 
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

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