Apache DataFusion SQL Query Engine
Update to rust 1.58 (#1557)
xudong.w811bb51a9672
diff --git a/ballista-examples/Cargo.toml b/ballista-examples/Cargo.tomlindex 338f69994b..d5f7d65d83 100644--- a/ballista-examples/Cargo.toml+++ b/ballista-examples/Cargo.toml@@ -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" }diff --git a/ballista/rust/client/Cargo.toml b/ballista/rust/client/Cargo.tomlindex 7736e949d2..b8ed26e30e 100644--- a/ballista/rust/client/Cargo.toml+++ b/ballista/rust/client/Cargo.toml@@ -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" }diff --git a/ballista/rust/executor/src/executor.rs b/ballista/rust/executor/src/executor.rsindex a7cd8ebe5e..ff2f08faaf 100644--- a/ballista/rust/executor/src/executor.rs+++ b/ballista/rust/executor/src/executor.rs@@ -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)diff --git a/ballista/rust/scheduler/src/planner.rs b/ballista/rust/scheduler/src/planner.rsindex 3d3884fd50..fdd143500b 100644--- a/ballista/rust/scheduler/src/planner.rs+++ b/ballista/rust/scheduler/src/planner.rs@@ -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:@@ -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:diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.tomlindex d20de3106b..a8def45b53 100644--- a/benchmarks/Cargo.toml+++ b/benchmarks/Cargo.toml@@ -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"]diff --git a/benchmarks/src/bin/tpch.rs b/benchmarks/src/bin/tpch.rsindex b676253eab..9563434601 100644--- a/benchmarks/src/bin/tpch.rs+++ b/benchmarks/src/bin/tpch.rs@@ -546,7 +546,7 @@ 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();@@ -554,9 +554,7 @@ async fn execute_query(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)?;}diff --git a/datafusion-cli/Cargo.toml b/datafusion-cli/Cargo.tomlindex d5347d8e00..62f63b432a 100644--- a/datafusion-cli/Cargo.toml+++ b/datafusion-cli/Cargo.toml@@ -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"diff --git a/datafusion-cli/Dockerfile b/datafusion-cli/Dockerfileindex fed14188fd..cef7afa8c9 100644--- a/datafusion-cli/Dockerfile+++ b/datafusion-cli/Dockerfile@@ -15,7 +15,7 @@# specific language governing permissions and limitations# under the License.-FROM rust:1.57 as builder+FROM rust:1.58 as builderCOPY ./datafusion /usr/src/datafusiondiff --git a/datafusion-examples/Cargo.toml b/datafusion-examples/Cargo.tomlindex 24d453e0b1..cfbba63722 100644--- a/datafusion-examples/Cargo.toml+++ b/datafusion-examples/Cargo.toml@@ -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"diff --git a/datafusion/Cargo.toml b/datafusion/Cargo.tomlindex bc37c7a0de..d5334130dd 100644--- a/datafusion/Cargo.toml+++ b/datafusion/Cargo.toml@@ -31,7 +31,7 @@ include = ["Cargo.toml",]edition = "2021"-rust-version = "1.57"+rust-version = "1.58"[lib]name = "datafusion"diff --git a/datafusion/src/physical_plan/expressions/rank.rs b/datafusion/src/physical_plan/expressions/rank.rsindex b82e9009d8..4facb8b555 100644--- a/datafusion/src/physical_plan/expressions/rank.rs+++ b/datafusion/src/physical_plan/expressions/rank.rs@@ -39,16 +39,16 @@ pub struct Rank {#[derive(Debug, Copy, Clone)]pub(crate) enum RankType {- Rank,- DenseRank,- PercentRank,+ Basic,+ Dense,+ Percent,}/// Create a rank window functionpub fn rank(name: String) -> Rank {Rank {name,- rank_type: RankType::Rank,+ rank_type: RankType::Basic,}}@@ -56,7 +56,7 @@ pub fn rank(name: String) -> Rank {pub fn dense_rank(name: String) -> Rank {Rank {name,- rank_type: RankType::DenseRank,+ rank_type: RankType::Dense,}}@@ -64,7 +64,7 @@ pub fn dense_rank(name: String) -> Rank {pub fn percent_rank(name: String) -> Rank {Rank {name,- rank_type: RankType::PercentRank,+ rank_type: RankType::Percent,}}@@ -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))}@@ -121,7 +121,7 @@ impl PartitionEvaluator for RankEvaluator {) -> Result<ArrayRef> {// see https://www.postgresql.org/docs/current/functions-window.htmllet 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..)@@ -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(@@ -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| {diff --git a/datafusion/src/physical_plan/file_format/parquet.rs b/datafusion/src/physical_plan/file_format/parquet.rsindex 78c9428e39..73f0b8ddb6 100644--- a/datafusion/src/physical_plan/file_format/parquet.rs+++ b/datafusion/src/physical_plan/file_format/parquet.rs@@ -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()@@ -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 operatorsend_result(&response_tx,diff --git a/datafusion/src/physical_plan/planner.rs b/datafusion/src/physical_plan/planner.rsindex 1ab78b24a4..fa0c101da3 100644--- a/datafusion/src/physical_plan/planner.rs+++ b/datafusion/src/physical_plan/planner.rs@@ -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),}@@ -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),}@@ -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),}diff --git a/datafusion/src/scalar.rs b/datafusion/src/scalar.rsindex a3f893f55e..e7c7db5217 100644--- a/datafusion/src/scalar.rs+++ b/datafusion/src/scalar.rs@@ -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)?,diff --git a/datafusion/src/test/variable.rs b/datafusion/src/test/variable.rsindex fcde0e9040..4a8bf94aa1 100644--- a/datafusion/src/test/variable.rs+++ b/datafusion/src/test/variable.rs@@ -35,7 +35,7 @@ impl SystemVar {impl VarProvider for SystemVar {/// get system variable valuefn 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)))}}@@ -54,7 +54,7 @@ impl UserDefinedVar {impl VarProvider for UserDefinedVar {/// Get user defined variable valuefn 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)))}}diff --git a/dev/docker/ballista-base.dockerfile b/dev/docker/ballista-base.dockerfileindex cf845e0760..b7460ed179 100644--- a/dev/docker/ballista-base.dockerfile+++ b/dev/docker/ballista-base.dockerfile@@ -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 builderRUN apt update && apt -y install musl musl-dev musl-tools libssl-dev openssl