Expand description
§Error Handling in DataFusion
In DataFusion, there are two types of errors that can be raised:
-
Expected errors – These indicate invalid operations performed by the caller, such as attempting to open a non-existent file. Different categories exist to distinguish their sources (e.g.,
DataFusionError::ArrowError,DataFusionError::IoError, etc.). -
Unexpected errors – Represented by
DataFusionError::Internal, these indicate that an internal invariant has been broken, suggesting a potential bug in the system.
There are several convenient macros for throwing errors. For example, use
exec_err! for expected errors.
For invariant checks, you can use assert_or_internal_err!,
assert_eq_or_internal_err!, assert_ne_or_internal_err! for easier assertions.
On the performance-critical path, use debug_assert! instead to reduce overhead.
Macros§
Structs§
- Data
Fusion Error Builder - A builder for
DataFusionError
Enums§
- Data
Fusion Error - DataFusion error
- Schema
Error - Schema-related errors
Functions§
- add_
possible_ columns_ to_ diag - field_
not_ found - Create a “field not found” DataFusion::SchemaError
- unqualified_
field_ not_ found - Convenience wrapper over
field_not_foundfor when there is no qualifier
Type Aliases§
- Generic
Error - Error type for generic operations that could result in DataFusionError::External
- Result
- Result type for operations that could result in an DataFusionError
- Shared
Result - Result type for operations that could result in an DataFusionError and needs to be shared (wrapped into
Arc).