Skip to content

Review use of panic in datafusion-expr crate #3312

@andygrove

Description

@andygrove

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/binary_rule.rs":385                 _ => unreachable!(),
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/binary_rule.rs":388         _ => unreachable!(),
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/expr_rewriter.rs":356                     let normalized_expr = normalized_expr.unwrap();
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/builder.rs":610                 && can_hash(self.plan.schema().field_from_column(l).unwrap().data_type())
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/builder.rs":615                 && can_hash(self.plan.schema().field_from_column(r).unwrap().data_type())
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/builder.rs":632             join.filter(filters.unwrap())
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/builder.rs":912                 .unwrap(),
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/display.rs":234         self.parent_ids.pop().unwrap();
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/plan.rs":546                 self.0.accept(&mut visitor).unwrap();
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/plan.rs":587                 self.0.accept(&mut visitor).unwrap();
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/plan.rs":638                 self.0.accept(&mut visitor).unwrap();
"/home/andy/git/apache/arrow-datafusion/datafusion/expr/src/logical_plan/plan.rs":643                 self.0.accept(&mut visitor).unwrap();

Describe the solution you'd like
Review code that can panic and see where it makes sense to return a Result instead. For example, It is generally better to use ? than unwrapon results.

The goal is not to remove all panics but review and make sure we are using them appropriately. Bonus points for adding documentation for invariants.

Describe alternatives you've considered
None

Additional context
File list generated by https://github.com/andygrove/no-need-to-panic

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions