Skip to content

Commit

Permalink
Update to rust 1.58 (#1557)
Browse files Browse the repository at this point in the history
  • Loading branch information
xudong963 authored Jan 14, 2022
1 parent d7e465a commit 811bb51
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 45 deletions.
2 changes: 1 addition & 1 deletion ballista-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license = "Apache-2.0"
keywords = [ "arrow", "distributed", "query", "sql" ]
edition = "2021"
publish = false
rust-version = "1.57"
rust-version = "1.58"

[dependencies]
datafusion = { path = "../datafusion" }
Expand Down
2 changes: 1 addition & 1 deletion ballista/rust/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ homepage = "https://github.com/apache/arrow-datafusion"
repository = "https://github.com/apache/arrow-datafusion"
authors = ["Apache Arrow <[email protected]>"]
edition = "2021"
rust-version = "1.57"
rust-version = "1.58"

[dependencies]
ballista-core = { path = "../core", version = "0.6.0" }
Expand Down
4 changes: 1 addition & 3 deletions ballista/rust/executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ impl Executor {
job_id,
stage_id,
part,
DisplayableExecutionPlan::with_metrics(&exec)
.indent()
.to_string()
DisplayableExecutionPlan::with_metrics(&exec).indent()
);

Ok(partitions)
Expand Down
4 changes: 2 additions & 2 deletions ballista/rust/scheduler/src/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ mod test {
.plan_query_stages(&job_uuid.to_string(), plan)
.await?;
for stage in &stages {
println!("{}", displayable(stage.as_ref()).indent().to_string());
println!("{}", displayable(stage.as_ref()).indent());
}

/* Expected result:
Expand Down Expand Up @@ -407,7 +407,7 @@ order by
.plan_query_stages(&job_uuid.to_string(), plan)
.await?;
for stage in &stages {
println!("{}", displayable(stage.as_ref()).indent().to_string());
println!("{}", displayable(stage.as_ref()).indent());
}

/* Expected result:
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ homepage = "https://github.com/apache/arrow-datafusion"
repository = "https://github.com/apache/arrow-datafusion"
license = "Apache-2.0"
publish = false
rust-version = "1.57"
rust-version = "1.58"

[features]
simd = ["datafusion/simd"]
Expand Down
6 changes: 2 additions & 4 deletions benchmarks/src/bin/tpch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,17 +546,15 @@ async fn execute_query(
if debug {
println!(
"=== Physical plan ===\n{}\n",
displayable(physical_plan.as_ref()).indent().to_string()
displayable(physical_plan.as_ref()).indent()
);
}
let runtime = ctx.state.lock().unwrap().runtime_env.clone();
let result = collect(physical_plan.clone(), runtime).await?;
if debug {
println!(
"=== Physical plan with metrics ===\n{}\n",
DisplayableExecutionPlan::with_metrics(physical_plan.as_ref())
.indent()
.to_string()
DisplayableExecutionPlan::with_metrics(physical_plan.as_ref()).indent()
);
pretty::print_batches(&result)?;
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ keywords = [ "arrow", "datafusion", "ballista", "query", "sql" ]
license = "Apache-2.0"
homepage = "https://github.com/apache/arrow-datafusion"
repository = "https://github.com/apache/arrow-datafusion"
rust-version = "1.57"
rust-version = "1.58"

[dependencies]
clap = "2.33"
Expand Down
2 changes: 1 addition & 1 deletion datafusion-cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.

FROM rust:1.57 as builder
FROM rust:1.58 as builder

COPY ./datafusion /usr/src/datafusion

Expand Down
2 changes: 1 addition & 1 deletion datafusion-examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ license = "Apache-2.0"
keywords = [ "arrow", "query", "sql" ]
edition = "2021"
publish = false
rust-version = "1.57"
rust-version = "1.58"

[[example]]
name = "avro_sql"
Expand Down
2 changes: 1 addition & 1 deletion datafusion/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ include = [
"Cargo.toml",
]
edition = "2021"
rust-version = "1.57"
rust-version = "1.58"

[lib]
name = "datafusion"
Expand Down
22 changes: 11 additions & 11 deletions datafusion/src/physical_plan/expressions/rank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,32 +39,32 @@ pub struct Rank {

#[derive(Debug, Copy, Clone)]
pub(crate) enum RankType {
Rank,
DenseRank,
PercentRank,
Basic,
Dense,
Percent,
}

/// Create a rank window function
pub fn rank(name: String) -> Rank {
Rank {
name,
rank_type: RankType::Rank,
rank_type: RankType::Basic,
}
}

/// Create a dense rank window function
pub fn dense_rank(name: String) -> Rank {
Rank {
name,
rank_type: RankType::DenseRank,
rank_type: RankType::Dense,
}
}

/// Create a percent rank window function
pub fn percent_rank(name: String) -> Rank {
Rank {
name,
rank_type: RankType::PercentRank,
rank_type: RankType::Percent,
}
}

Expand All @@ -77,8 +77,8 @@ impl BuiltInWindowFunctionExpr for Rank {
fn field(&self) -> Result<Field> {
let nullable = false;
let data_type = match self.rank_type {
RankType::Rank | RankType::DenseRank => DataType::UInt64,
RankType::PercentRank => DataType::Float64,
RankType::Basic | RankType::Dense => DataType::UInt64,
RankType::Percent => DataType::Float64,
};
Ok(Field::new(self.name(), data_type, nullable))
}
Expand Down Expand Up @@ -121,7 +121,7 @@ impl PartitionEvaluator for RankEvaluator {
) -> Result<ArrayRef> {
// see https://www.postgresql.org/docs/current/functions-window.html
let result: ArrayRef = match self.rank_type {
RankType::DenseRank => Arc::new(UInt64Array::from_iter_values(
RankType::Dense => Arc::new(UInt64Array::from_iter_values(
ranks_in_partition
.iter()
.zip(1u64..)
Expand All @@ -130,7 +130,7 @@ impl PartitionEvaluator for RankEvaluator {
iter::repeat(rank).take(len)
}),
)),
RankType::PercentRank => {
RankType::Percent => {
// Returns the relative rank of the current row, that is (rank - 1) / (total partition rows - 1). The value thus ranges from 0 to 1 inclusive.
let denominator = (partition.end - partition.start) as f64;
Arc::new(Float64Array::from_iter_values(
Expand All @@ -146,7 +146,7 @@ impl PartitionEvaluator for RankEvaluator {
.flatten(),
))
}
RankType::Rank => Arc::new(UInt64Array::from_iter_values(
RankType::Basic => Arc::new(UInt64Array::from_iter_values(
ranks_in_partition
.iter()
.scan(1_u64, |acc, range| {
Expand Down
15 changes: 4 additions & 11 deletions datafusion/src/physical_plan/file_format/parquet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,8 @@ macro_rules! get_min_max_values {
};

let data_type = field.data_type();
let null_scalar: ScalarValue = if let Ok(v) = data_type.try_into() {
v
} else {
// DataFusion doesn't have support for ScalarValues of the column type
return None
};
// The result may be None, because DataFusion doesn't have support for ScalarValues of the column type
let null_scalar: ScalarValue = data_type.try_into().ok()?;

let scalar_values : Vec<ScalarValue> = $self.row_group_metadata
.iter()
Expand Down Expand Up @@ -441,11 +437,8 @@ fn read_partition(
break;
}
Some(Err(e)) => {
let err_msg = format!(
"Error reading batch from {}: {}",
partitioned_file,
e.to_string()
);
let err_msg =
format!("Error reading batch from {}: {}", partitioned_file, e);
// send error to operator
send_result(
&response_tx,
Expand Down
6 changes: 3 additions & 3 deletions datafusion/src/physical_plan/planner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ mod tests {
Err(e) => assert!(
e.to_string().contains(expected_error),
"Error '{}' did not contain expected error '{}'",
e.to_string(),
e,
expected_error
),
}
Expand Down Expand Up @@ -1674,7 +1674,7 @@ mod tests {
Err(e) => assert!(
e.to_string().contains(expected_error),
"Error '{}' did not contain expected error '{}'",
e.to_string(),
e,
expected_error
),
}
Expand Down Expand Up @@ -1733,7 +1733,7 @@ mod tests {
Err(e) => assert!(
e.to_string().contains(expected_error),
"Error '{}' did not contain expected error '{}'",
e.to_string(),
e,
expected_error
),
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/src/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@ impl fmt::Display for ScalarValue {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
ScalarValue::Decimal128(v, p, s) => {
write!(f, "{}", format!("{:?},{:?},{:?}", v, p, s))?;
write!(f, "{:?},{:?},{:?}", v, p, s)?;
}
ScalarValue::Boolean(e) => format_option!(f, e)?,
ScalarValue::Float32(e) => format_option!(f, e)?,
Expand Down
4 changes: 2 additions & 2 deletions datafusion/src/test/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl SystemVar {
impl VarProvider for SystemVar {
/// get system variable value
fn get_value(&self, var_names: Vec<String>) -> Result<ScalarValue> {
let s = format!("{}-{}", "system-var".to_string(), var_names.concat());
let s = format!("{}-{}", "system-var", var_names.concat());
Ok(ScalarValue::Utf8(Some(s)))
}
}
Expand All @@ -54,7 +54,7 @@ impl UserDefinedVar {
impl VarProvider for UserDefinedVar {
/// Get user defined variable value
fn get_value(&self, var_names: Vec<String>) -> Result<ScalarValue> {
let s = format!("{}-{}", "user-defined-var".to_string(), var_names.concat());
let s = format!("{}-{}", "user-defined-var", var_names.concat());
Ok(ScalarValue::Utf8(Some(s)))
}
}
2 changes: 1 addition & 1 deletion dev/docker/ballista-base.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


# Base image extends debian:buster-slim
FROM rust:1.57.0-buster AS builder
FROM rust:1.58.0-buster AS builder

RUN apt update && apt -y install musl musl-dev musl-tools libssl-dev openssl

Expand Down

0 comments on commit 811bb51

Please sign in to comment.