Skip to content

Commit

Permalink
fix clippy and fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Nov 21, 2023
1 parent 0622803 commit b75c7e4
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 12 deletions.
15 changes: 15 additions & 0 deletions src/batch/clippy.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,18 @@ disallowed-types = [
{ path = "risingwave_common::error::ToRwResult", reason = "Please use per-crate error type instead." },
{ path = "risingwave_common::error::ToErrorStr", reason = "Please use per-crate error type instead." },
]

doc-valid-idents = [
"RisingWave",
"MinIO",
"ProtoBuf",
"BloomFilter",
"gRPC",
"PostgreSQL",
"MySQL",
"TopN",
"VNode"
]
avoid-breaking-exported-api = false
upper-case-acronyms-aggressive = true
too-many-arguments-threshold = 10
2 changes: 2 additions & 0 deletions src/batch/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(clippy::disallowed_types, clippy::disallowed_methods)]

use std::sync::Arc;

pub use anyhow::anyhow;
Expand Down
5 changes: 1 addition & 4 deletions src/batch/src/executor/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use anyhow::anyhow;
use futures_async_stream::try_stream;
use risingwave_common::array::ArrayImpl::Bool;
use risingwave_common::array::DataChunk;
Expand Down Expand Up @@ -67,9 +66,7 @@ impl FilterExecutor {
yield data_chunk;
}
} else {
return Err(
BatchError::Internal(anyhow!("Filter can only receive bool array")).into(),
);
bail!("Filter can only receive bool array");
}
}

Expand Down
3 changes: 1 addition & 2 deletions src/batch/src/executor/join/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ fn concatenate(left: &DataChunk, right: &DataChunk) -> Result<DataChunk> {
(false, false) => {
return Err(BatchError::UnsupportedFunction(
"The concatenate behaviour of two chunk with visibility is undefined".to_string(),
)
.into())
));
}
};
let data_chunk = DataChunk::new(concated_columns, vis);
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/task/broadcast_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use risingwave_pb::batch_plan::*;
use tokio::sync::mpsc;

use crate::error::BatchError::{Internal, SenderError};
use crate::error::{BatchError, SharedResult, Result as BatchResult};
use crate::error::{BatchError, Result as BatchResult, SharedResult};
use crate::task::channel::{ChanReceiver, ChanReceiverImpl, ChanSender, ChanSenderImpl};
use crate::task::data_chunk_in_channel::DataChunkInChannel;

Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/task/consistent_hash_shuffle_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use risingwave_pb::batch_plan::*;
use tokio::sync::mpsc;

use crate::error::BatchError::{Internal, SenderError};
use crate::error::{BatchError, SharedResult, Result as BatchResult};
use crate::error::{BatchError, Result as BatchResult, SharedResult};
use crate::task::channel::{ChanReceiver, ChanReceiverImpl, ChanSender, ChanSenderImpl};
use crate::task::data_chunk_in_channel::DataChunkInChannel;

Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/task/fifo_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use risingwave_common::array::DataChunk;
use tokio::sync::mpsc;

use crate::error::BatchError::{Internal, SenderError};
use crate::error::{BatchError, SharedResult, Result as BatchResult};
use crate::error::{BatchError, Result as BatchResult, SharedResult};
use crate::task::channel::{ChanReceiver, ChanReceiverImpl, ChanSender, ChanSenderImpl};
use crate::task::data_chunk_in_channel::DataChunkInChannel;
#[derive(Clone)]
Expand Down
2 changes: 1 addition & 1 deletion src/batch/src/task/hash_shuffle_channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use risingwave_pb::batch_plan::*;
use tokio::sync::mpsc;

use crate::error::BatchError::{Internal, SenderError};
use crate::error::{BatchError, SharedResult, Result as BatchResult};
use crate::error::{BatchError, Result as BatchResult, SharedResult};
use crate::task::channel::{ChanReceiver, ChanReceiverImpl, ChanSender, ChanSenderImpl};
use crate::task::data_chunk_in_channel::DataChunkInChannel;
#[derive(Clone)]
Expand Down
4 changes: 2 additions & 2 deletions src/batch/src/task/task_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -633,12 +633,12 @@ impl<C: BatchTaskContext> BatchTaskExecution<C> {
// There is no message received from shutdown channel, which means it caused
// task failed.
error!("Batch task failed: {:?}", e);
error = Some(BatchError::from(e));
error = Some(e);
state = TaskStatus::Failed;
break;
}
ShutdownMsg::Abort(_) => {
error = Some(BatchError::from(e));
error = Some(e);
state = TaskStatus::Aborted;
break;
}
Expand Down

0 comments on commit b75c7e4

Please sign in to comment.