-
Notifications
You must be signed in to change notification settings - Fork 600
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor:introduce per crate error for batch executors (#3658)
* introduce error.rs in batch/executor * modify error type * modify mod.rs to use BatchExecutorError * modify error to compatible RwError * modify delete executor * modify filter * modify generic_exchange * modify hop_windows * modify hash_agg * modify insert * modify * modify * modify error * fix clippy * rename BatchExecutorError to BatchError * fix format Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
085d256
commit 67dbe53
Showing
15 changed files
with
113 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2022 Singularity Data | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
pub use anyhow::anyhow; | ||
use risingwave_common::array::ArrayError; | ||
use risingwave_common::error::{ErrorCode, RwError}; | ||
use thiserror::Error; | ||
|
||
pub type Result<T> = std::result::Result<T, BatchError>; | ||
|
||
pub trait Error = std::error::Error + Send + Sync + 'static; | ||
|
||
#[derive(Error, Debug)] | ||
pub enum BatchError { | ||
#[error("Unsupported function: {0}")] | ||
UnsupportedFunction(String), | ||
|
||
#[error("Can't cast {0} to {1}")] | ||
Cast(&'static str, &'static str), | ||
|
||
#[error("Array error: {0}")] | ||
Array(#[from] ArrayError), | ||
|
||
#[error("Out of range")] | ||
NumericOutOfRange, | ||
|
||
#[error(transparent)] | ||
Internal(#[from] anyhow::Error), | ||
} | ||
|
||
impl From<BatchError> for RwError { | ||
fn from(s: BatchError) -> Self { | ||
ErrorCode::BatchError(Box::new(s)).into() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.