-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add a version()
UDF
#12429
Add a version()
UDF
#12429
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @samuelcolvin -- this looks very useful.
Can we please also add an entry in the documentation about this function: https://datafusion.apache.org/user-guide/sql/scalar_functions.html#other-functions
It would be nice if we could auto generate this documentation so we don't have to remember to add this type of documentation each time. I will write up a ticket explaining this
I filed #12432 to track this idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also think we should add a basic test to https://github.com/apache/datafusion/blob/main/datafusion/sqllogictest/test_files/information_schema.slt
(this file has to be updated on every version bump anyways so adding a test there will not increase the release burden)
done |
+--------------------------------------------+ | ||
| version() | | ||
+--------------------------------------------+ | ||
| Apache DataFusion 41.0.0, aarch64 on macos | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note! this will go out of date very quickly, do we care?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it matters if the doc example doesn't reflect the current version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very useful feature! Thanks @samuelcolvin 👍
Since the function has the architecture in its output too, I don't think there is a way to cover it with tests in slt that wouldn't fail on some platforms. We would have to do it via rust tests where we could I think it is ok to merge as is and I will make a PR shortly to add a test. |
Thanks again @samuelcolvin and @Weijun-H |
Test PR: #12441 |
Which issue does this PR close?
Closes #12424
Rationale for this change
Pretty self explanatory — it's use to know what version of a database you're using.
What changes are included in this PR?
Adds a
version()
UDF.Usage:
I'd like to add:
datafusion::DATAFUSION_VERSION
Are these changes tested?
yes
Are there any user-facing changes?
Just one new UDF.