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

Add example of using Expr::field in 37.1.0 #10183

Closed
wants to merge 3 commits into from

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Apr 22, 2024

I don't intend to merge this, but I want to put it up to illustrate how to use the 37.1.0 API to do this reasonably

Which issue does this PR close?

Part of #10181

Rationale for this change

Some users create expressions outside the context of a query that has an analyzer, etc. Some expressions now can only be used via udfs.

What changes are included in this PR?

Add example of using Expr::field in 37.1.0

Are these changes tested?

Are there any user-facing changes?

let expr = expr
.transform_up(&|expr| {
Ok(match expr {
Expr::GetIndexedField(GetIndexedField {
Copy link
Contributor Author

@alamb alamb Apr 22, 2024

Choose a reason for hiding this comment

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

This basically inlines the necessary code from

Expr::GetIndexedField(GetIndexedField {
expr,
field: GetFieldAccess::NamedStructField { name },
}) => {
let expr = *expr.clone();
let name = Expr::Literal(name);
Transformed::yes(get_field(expr, name.clone()))

@alamb
Copy link
Contributor Author

alamb commented May 6, 2024

Here is the proposed public API that should complete this actual issue: #10330

@alamb alamb closed this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant