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

Minor: Add a test for version() function #12441

Merged
merged 1 commit into from
Sep 12, 2024
Merged

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Sep 12, 2024

Which issue does this PR close?

Part of #12424
Follow on to #12429

Rationale for this change

Testing the version() function is a bit tricky as the output is platform and version dependent so we didn't put one in #12429

What changes are included in this PR?

Add a test for version()

Are these changes tested?

All tests

Are there any user-facing changes?

No, this is test only

@github-actions github-actions bot added the core Core DataFusion crate label Sep 12, 2024

#[tokio::test]
async fn test_version_function() {
let expected_version = format!(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The best I can come up with was to programatically create the same expected output.

It would be better to make it with something different, but given it changes with architecture and release this is the best I could come up with

@alamb alamb mentioned this pull request Sep 12, 2024
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm thanks @alamb I'm just thinking should be a version a SQL function or we can extend the SHOW statement

@alamb
Copy link
Contributor Author

alamb commented Sep 12, 2024

lgtm thanks @alamb I'm just thinking should be a version a SQL function or we can extend the SHOW statement

You mean like

> SHOW ALL
...
| datafusion.execution.parquet.created_by                                 | datafusion version 41.0.0 |

Maybe we could just have a datafusion.version?

@comphead
Copy link
Contributor

lgtm thanks @alamb I'm just thinking should be a version a SQL function or we can extend the SHOW statement

You mean like

> SHOW ALL
...
| datafusion.execution.parquet.created_by                                 | datafusion version 41.0.0 |

Maybe we could just have a datafusion.version?

I was actually thinking about SHOW VERSION but having it in datafusion variables is also good. We can always refer to it
like SHOW datafusion.version like now we do for > show datafusion.execution.batch_size;

@alamb
Copy link
Contributor Author

alamb commented Sep 12, 2024

> show version;
Error during planning: 'version' is not a variable which can be viewed with 'SHOW'

It seems like it would be fairly straightforward to add support for SHOW VERSION

@alamb alamb merged commit 1d985ac into apache:main Sep 12, 2024
25 checks passed
@alamb
Copy link
Contributor Author

alamb commented Sep 12, 2024

Thanks again @comphead

@alamb alamb deleted the version-udf branch September 12, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants