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

Replace GetFieldAccessExpr::NamedStructField with ScalarFunction::Struct #9532

Closed
jayzhan211 opened this issue Mar 10, 2024 · 5 comments · Fixed by #9563
Closed

Replace GetFieldAccessExpr::NamedStructField with ScalarFunction::Struct #9532

jayzhan211 opened this issue Mar 10, 2024 · 5 comments · Fixed by #9563
Assignees
Labels
enhancement New feature or request

Comments

@jayzhan211
Copy link
Contributor

Is your feature request related to a problem or challenge?

Follow up from #9492, we replace ListRange and ListIndex to array_slice and array element respectively.
NamedStructField is also possible to be rewritten to Struct function.

https://github.com/apache/arrow-datafusion/blob/f1f09653319aea3186c2b1f9ca103ef7030c2da1/datafusion/physical-expr/src/expressions/get_indexed_field.rs#L138-L162

Describe the solution you'd like

Replace NamedStructField with Struct function
I think it may be relative easy issue since it should be similar to #9492. But, not sure if it is easy enough to be a good first issue. I think you can consider it as good second issue 😆

Describe alternatives you've considered

No response

Additional context

No response

@jayzhan211 jayzhan211 added the enhancement New feature or request label Mar 10, 2024
@alamb
Copy link
Contributor

alamb commented Mar 10, 2024

Specificlaly, I think we would need to:

  1. Add a "get_field(struct_array, field_name)" function
  2. Use that function instead of NamedStructField

@yyy1000
Copy link
Contributor

yyy1000 commented Mar 11, 2024

I port Struct function in #9546
I think after that I can take this issue. :)

@yyy1000
Copy link
Contributor

yyy1000 commented Mar 11, 2024

take

@yyy1000
Copy link
Contributor

yyy1000 commented Mar 12, 2024

Ah, I found the struct function has different meaning than NamedStructField, so I'm trying to implement get_field(struct_array, field_name) as @alamb said. It will take some time because I kind of stuck on return_type_from_exprs method. (I think the return type will depends on the param)

@yyy1000
Copy link
Contributor

yyy1000 commented Mar 12, 2024

Update: I finished the PR at #9563
Could you help me review it when you are available? @alamb @jayzhan211
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
3 participants