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

once now() is called in a statement, it forever returns the same value #3057

Closed
Tracked by #3148
kmitchener opened this issue Aug 6, 2022 · 3 comments · Fixed by #3210
Closed
Tracked by #3148

once now() is called in a statement, it forever returns the same value #3057

kmitchener opened this issue Aug 6, 2022 · 3 comments · Fixed by #3210
Labels
bug Something isn't working

Comments

@kmitchener
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

select now();
-- ... 3 days later ...
select now(); -- returns same old value

It's correctly caching now() so it returns the same value when used multiple times in the same query, but it shouldn't be caching the value past statement execution, correct?

To Reproduce
Steps to reproduce the behavior:

Expected behavior
A clear and concise description of what you expected to happen.

Would expect now() to return the same value for all instances in the same query, but a new value for a new statement in the same runtime context.

Additional context
Add any other context about the problem here.

@kmitchener kmitchener added the bug Something isn't working label Aug 6, 2022
@andygrove
Copy link
Member

It's correctly caching now() so it returns the same value when used multiple times in the same query, but it shouldn't be caching the value past statement execution, correct?

You are right. This is a bug.

@waitingkuo
Copy link
Contributor

waitingkuo commented Aug 7, 2022

looks like now() is using the query_execution_start_time in session state which only created once per SessionContext

https://github.com/apache/arrow-datafusion/blob/master/datafusion/physical-expr/src/execution_props.rs#L32

@alamb
Copy link
Contributor

alamb commented Aug 15, 2022

Agree -- now() should update between each statement but stay the same within a statement

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants