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

Simplify error handling in case.rs #13990

Open
aweltsch opened this issue Jan 2, 2025 · 2 comments
Open

Simplify error handling in case.rs #13990

aweltsch opened this issue Jan 2, 2025 · 2 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@aweltsch
Copy link
Contributor

aweltsch commented Jan 2, 2025

Is your feature request related to a problem or challenge?

As part of the review for #13953 @2010YOUY01 brought up that some of the error handling code in datafusion/physical-expr/src/expressions/case.rs can be simplified, due to type checks being performed before evaluation.
This will clean-up and simplify the code a little bit.

Describe the solution you'd like

Replace occurences similar to

            DataFusionError::Context(
                "WHEN expression did not return a BooleanArray".to_string(),
                Box::new(e),
            )

and

        let expr = try_cast(Arc::clone(e), &batch.schema(), return_type.clone())
            .unwrap_or_else(|_| Arc::clone(e));

with code that returns an internal error directly

Describe alternatives you've considered

No response

Additional context

Link to suggestions from the review:

@aweltsch aweltsch added the enhancement New feature or request label Jan 2, 2025
@alamb alamb added the good first issue Good for newcomers label Jan 4, 2025
@alamb
Copy link
Contributor

alamb commented Jan 4, 2025

I think this is a nice issue for someone who wants to clean up the code and learn how DataFusion works but doesn't require detailed internals understanding

@cj-zhukov
Copy link
Contributor

take

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

No branches or pull requests

3 participants