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

fix: inline datafusion_common #2963

Merged
merged 3 commits into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions rust/lance-core/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// SPDX-FileCopyrightText: Copyright The Lance Authors

use arrow_schema::ArrowError;
use datafusion_common::DataFusionError;
use snafu::{Location, Snafu};

type BoxedError = Box<dyn std::error::Error + Send + Sync + 'static>;
Expand Down Expand Up @@ -306,38 +305,38 @@ impl From<datafusion_sql::sqlparser::tokenizer::TokenizerError> for Error {
}

#[cfg(feature = "datafusion")]
impl From<Error> for DataFusionError {
impl From<Error> for datafusion_common::DataFusionError {
#[track_caller]
fn from(e: Error) -> Self {
Self::Execution(e.to_string())
}
}

#[cfg(feature = "datafusion")]
impl From<DataFusionError> for Error {
impl From<datafusion_common::DataFusionError> for Error {
#[track_caller]
fn from(e: DataFusionError) -> Self {
fn from(e: datafusion_common::DataFusionError) -> Self {
let location = std::panic::Location::caller().to_snafu_location();
match e {
DataFusionError::SQL(..)
| DataFusionError::Plan(..)
| DataFusionError::Configuration(..) => Self::InvalidInput {
datafusion_common::DataFusionError::SQL(..)
| datafusion_common::DataFusionError::Plan(..)
| datafusion_common::DataFusionError::Configuration(..) => Self::InvalidInput {
source: box_error(e),
location,
},
DataFusionError::SchemaError(..) => Self::Schema {
datafusion_common::DataFusionError::SchemaError(..) => Self::Schema {
message: e.to_string(),
location,
},
DataFusionError::ArrowError(..) => Self::Arrow {
datafusion_common::DataFusionError::ArrowError(..) => Self::Arrow {
message: e.to_string(),
location,
},
DataFusionError::NotImplemented(..) => Self::NotSupported {
datafusion_common::DataFusionError::NotImplemented(..) => Self::NotSupported {
source: box_error(e),
location,
},
DataFusionError::Execution(..) => Self::Execution {
datafusion_common::DataFusionError::Execution(..) => Self::Execution {
message: e.to_string(),
location,
},
Expand Down
Loading