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

Implement current_date Function #3981

Closed
2 tasks
Tracked by #3148
alamb opened this issue Oct 27, 2022 · 7 comments · Fixed by #4022
Closed
2 tasks
Tracked by #3148

Implement current_date Function #3981

alamb opened this issue Oct 27, 2022 · 7 comments · Fixed by #4022
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Oct 27, 2022

Is your feature request related to a problem or challenge? Please describe what you are trying to do.
As we add more full featured date/time support for DataFusion users need to be able to use the current date to calculate things like "all data in the last 30 days"

Describe the solution you'd like
Support the current_date postgres function https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
This is a feature request we got from an early (internal) user of InfluxDB IOx

I believe this is a good first issue as you can follow the existing implementation of now()

It would be a good exercise to add a new build in scalar function, physical planing support, and then tests

@alamb alamb added enhancement New feature or request good first issue Good for newcomers labels Oct 27, 2022
@comphead
Copy link
Contributor

@alamb please assign the task to me.

And let me know how to regenerate prost.rs locally to reflect latest changes for Scalar types?

@alamb
Copy link
Contributor Author

alamb commented Oct 29, 2022

Thanks @comphead

@alamb please assign the task to me.

Done

And let me know how to regenerate prost.rs locally to reflect latest changes for Scalar types?

It may be related to #3947 / #3979 . Maybe @avantgardnerio or @tustvold have some ideas or a doc pointer

@avantgardnerio
Copy link
Contributor

@tustvold I see you added instructions for installing protoc... would you mind adding the bash command you use to run it? 🙌

@tustvold
Copy link
Contributor

There is no command, just build the project as normal, the build script does the rest

@comphead
Copy link
Contributor

Hi @tustvold

I have tried to build it first

$ cargo build
Compiling datafusion-proto v13.0.0 (arrow-datafusion/datafusion/proto)
error[E0599]: no variant or associated item named `CurrentDate` found for enum `datafusion::ScalarFunction` in the current scope
    --> datafusion/proto/src/to_proto.rs:1181:57
     |
1181 |             BuiltinScalarFunction::CurrentDate => Self::CurrentDate,
     |                                                         ^^^^^^^^^^^ variant or associated item not found in `datafusion::ScalarFunction`
     |
    ::: datafusion/proto/src/generated/prost.rs:1154:1

If I go to prost.rs I dont see CurrentDate generated. I suppose BuiltinScalarFunction enum is the driver to generate new code?

@tustvold
Copy link
Contributor

@comphead
Copy link
Contributor

Have you updated the protobuf definition in https://github.com/apache/arrow-datafusion/blob/master/datafusion/proto/proto/datafusion.proto ?

Right, sorry, totally forgot about it! :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants