adriangb commented on PR #19426:
URL: https://github.com/apache/datafusion/pull/19426#issuecomment-3677918644

   > Could you elaborate a bit more on the motivating use case? I'm having a 
bit of trouble understanding it from the original issue.
   
   Sure yes. I am working on a feature to cache / materialize scan subtrees of 
queries. I am essentially transforming a query like:
   
   ```sql
   select time_bucket('1 minute', ts)
   from t
   where ts > now() - interval '1 hour';
   ```
   
   Into a materializable subtree:
   
   ```sql
   select time_bucket('1 minute', ts) as __0, ts
   from t;
   ```
   
   And a query to apply on top of that:
   
   ```sql
   select __0 as "time_bucket('1 minute', ts)"
   from __mv
   where ts > now() - interval '1 hour';
   ```
   
   As part of this I want to be able to pass the SQL text / string through 
optimizers to generally normalize / optimize the query, but this currently 
evaluates `now()`, which would result in materializing:
   
   ```sql
   select time_bucket('1 minute', ts) as __0, ts
   from t
   where ts > '2025-...';
   ```
   
   Because I have no way of differentiating a literal date from an evaluated 
`now()`.


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