Skip to content

Commit 6aa7588

Browse files
authored
fix: fix clippy issue after rust update to 1.8.7 (#1262)
`large-error-threshold` is the changed clippy option which makes noise. ballista controlled code has been fixed to address it, new `clippy.toml` rule has been added to disable check util we update to datafusion 48 where it will be fixed for datafusion related code.
1 parent 90fdf18 commit 6aa7588

File tree

3 files changed

+34
-8
lines changed

3 files changed

+34
-8
lines changed

ballista/core/src/error.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ pub enum BallistaError {
3939
Internal(String),
4040
Configuration(String),
4141
ArrowError(ArrowError),
42-
DataFusionError(DataFusionError),
42+
DataFusionError(Box<DataFusionError>),
4343
SqlError(parser::ParserError),
4444
IoError(io::Error),
4545
TonicError(tonic::transport::Error),
46-
GrpcError(tonic::Status),
46+
GrpcError(Box<tonic::Status>),
4747
GrpcConnectionError(String),
4848
TokioError(tokio::task::JoinError),
4949
GrpcActionError(String),
@@ -80,7 +80,9 @@ impl From<ArrowError> for BallistaError {
8080
ArrowError::ExternalError(e)
8181
if e.downcast_ref::<DataFusionError>().is_some() =>
8282
{
83-
BallistaError::DataFusionError(*e.downcast::<DataFusionError>().unwrap())
83+
BallistaError::DataFusionError(Box::new(
84+
*e.downcast::<DataFusionError>().unwrap(),
85+
))
8486
}
8587
other => BallistaError::ArrowError(other),
8688
}
@@ -97,7 +99,7 @@ impl From<DataFusionError> for BallistaError {
9799
fn from(e: DataFusionError) -> Self {
98100
match e {
99101
DataFusionError::ArrowError(e, _) => Self::from(e),
100-
_ => BallistaError::DataFusionError(e),
102+
_ => BallistaError::DataFusionError(Box::new(e)),
101103
}
102104
}
103105
}
@@ -116,7 +118,7 @@ impl From<tonic::transport::Error> for BallistaError {
116118

117119
impl From<tonic::Status> for BallistaError {
118120
fn from(e: tonic::Status) -> Self {
119-
BallistaError::GrpcError(e)
121+
BallistaError::GrpcError(Box::new(e))
120122
}
121123
}
122124

@@ -216,9 +218,11 @@ impl From<BallistaError> for FailedTask {
216218
failed_reason: Some(FailedReason::IoError(IoError {})),
217219
}
218220
}
219-
BallistaError::DataFusionError(DataFusionError::IoError(io)) => {
221+
BallistaError::DataFusionError(e)
222+
if matches!(*e, DataFusionError::IoError(_)) =>
223+
{
220224
FailedTask {
221-
error: format!("Task failed due to DataFusion IO error: {io:?}"),
225+
error: format!("Task failed due to DataFusion IO error: {e:?}"),
222226
// IO error is considered to be temporary and retryable
223227
retryable: true,
224228
count_to_failures: true,

ballista/core/src/serde/scheduler/from_proto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,5 +426,5 @@ fn reset_metrics_for_execution_plan(
426426
plan.with_new_children(children).map(Transformed::yes)
427427
})
428428
.data()
429-
.map_err(BallistaError::DataFusionError)
429+
.map_err(|e| BallistaError::DataFusionError(Box::new(e)))
430430
}

clippy.toml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
18+
# increasing the threshold until we get to datafusion 48 which should
19+
# address this issue.
20+
#
21+
# https://github.com/apache/datafusion/pull/15861
22+
large-error-threshold = 266

0 commit comments

Comments
 (0)