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

Improve signature of get_field is function #10566

Closed
alamb opened this issue May 17, 2024 · 0 comments · Fixed by #10569
Closed

Improve signature of get_field is function #10566

alamb opened this issue May 17, 2024 · 0 comments · Fixed by #10569
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented May 17, 2024

Is your feature request related to a problem or challenge?

The signature of get_field is akward -- it requires a string but the function signature takes a "Expr" so you have to wrap it with lit

you would have to write

get_field(col("a"), lit("value")

Previously you could write

col("a").field("value")

but after #10565 that panics

Describe the solution you'd like

I would like to have get_field take a str instead:

get_field(col("a"), "value")

Probably with a signature like

fn get_field(expr, field_name: impl Into<Literal>) -> Expr {
  let field_name_as_expr = lit(field_name.into());
  ..
}

Describe alternatives you've considered

leave it as is

Additional context

No response

@alamb alamb added the enhancement New feature or request label May 17, 2024
@jayzhan211 jayzhan211 added the good first issue Good for newcomers label May 18, 2024
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.

2 participants