From c2534c631ba106eae3d59c94cc100ee80f2741f4 Mon Sep 17 00:00:00 2001 From: discord9 Date: Thu, 15 Aug 2024 09:49:30 +0800 Subject: [PATCH] chore: after rebase --- src/flow/src/expr/scalar.rs | 2 +- src/flow/src/transform.rs | 18 ++++-------------- src/flow/src/transform/aggr.rs | 11 +++++------ src/flow/src/transform/plan.rs | 10 +++++----- 4 files changed, 15 insertions(+), 26 deletions(-) diff --git a/src/flow/src/expr/scalar.rs b/src/flow/src/expr/scalar.rs index 0947713862e2..c4d698529878 100644 --- a/src/flow/src/expr/scalar.rs +++ b/src/flow/src/expr/scalar.rs @@ -30,7 +30,7 @@ use crate::expr::error::{ }; use crate::expr::func::{BinaryFunc, UnaryFunc, UnmaterializableFunc, VariadicFunc}; use crate::expr::{Batch, DfScalarFunction}; -use crate::repr::{ColumnType, RelationType}; +use crate::repr::ColumnType; /// A scalar expression with a known type. #[derive(Ord, PartialOrd, Clone, Debug, Eq, PartialEq, Hash)] pub struct TypedExpr { diff --git a/src/flow/src/transform.rs b/src/flow/src/transform.rs index 1f7f87400b8e..135ce7d37fc0 100644 --- a/src/flow/src/transform.rs +++ b/src/flow/src/transform.rs @@ -17,28 +17,18 @@ use std::collections::{BTreeMap, HashMap}; use std::sync::Arc; use common_error::ext::BoxedError; -use common_query::error::InvalidFuncArgsSnafu; -use common_telemetry::info; -use datafusion::config::ConfigOptions; -use datafusion::optimizer::analyzer::type_coercion::TypeCoercion; -use datafusion::optimizer::simplify_expressions::SimplifyExpressions; -use datafusion::optimizer::{AnalyzerRule, OptimizerContext, OptimizerRule}; use datatypes::data_type::ConcreteDataType as CDT; -use query::parser::QueryLanguageParser; -use query::plan::LogicalPlan; -use query::query_engine::DefaultSerializer; use query::QueryEngine; use serde::{Deserialize, Serialize}; use snafu::ResultExt; /// note here we are using the `substrait_proto_df` crate from the `substrait` module and /// rename it to `substrait_proto` -use substrait::{substrait_proto_df as substrait_proto, DFLogicalSubstraitConvertor}; +use substrait::substrait_proto_df as substrait_proto; use substrait_proto::proto::extensions::simple_extension_declaration::MappingType; use substrait_proto::proto::extensions::SimpleExtensionDeclaration; use crate::adapter::FlownodeContext; -use crate::error::{DatafusionSnafu, Error, ExternalSnafu, NotImplementedSnafu, UnexpectedSnafu}; -use crate::plan::TypedPlan; +use crate::error::{Error, NotImplementedSnafu, UnexpectedSnafu}; /// a simple macro to generate a not implemented error macro_rules! not_impl_err { ($($arg:tt)*) => { @@ -173,6 +163,7 @@ mod test { use prost::Message; use query::parser::QueryLanguageParser; use query::plan::LogicalPlan; + use query::query_engine::DefaultSerializer; use query::QueryEngine; use session::context::QueryContext; use substrait::{DFLogicalSubstraitConvertor, SubstraitPlan}; @@ -182,10 +173,9 @@ mod test { use super::*; use crate::adapter::node_context::IdToNameMap; + use crate::df_optimizer::apply_df_optimizer; use crate::expr::GlobalId; use crate::repr::{ColumnType, RelationType}; - use crate::df_optimizer::apply_df_optimizer; - use crate::repr::ColumnType; pub fn create_test_ctx() -> FlownodeContext { let mut schemas = HashMap::new(); diff --git a/src/flow/src/transform/aggr.rs b/src/flow/src/transform/aggr.rs index e9f7709c0472..42578279125e 100644 --- a/src/flow/src/transform/aggr.rs +++ b/src/flow/src/transform/aggr.rs @@ -12,10 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::BTreeMap; - -use datatypes::data_type::DataType; -use datatypes::value::Value; use itertools::Itertools; use snafu::OptionExt; use substrait_proto::proto::aggregate_function::AggregationInvocation; @@ -25,7 +21,7 @@ use substrait_proto::proto::{self}; use crate::error::{Error, NotImplementedSnafu, PlanSnafu}; use crate::expr::{ - AggregateExpr, AggregateFunc, BinaryFunc, MapFilterProject, ScalarExpr, TypedExpr, UnaryFunc, + AggregateExpr, AggregateFunc, MapFilterProject, ScalarExpr, TypedExpr, UnaryFunc, }; use crate::plan::{AccumulablePlan, AggrWithIndex, KeyValPlan, Plan, ReducePlan, TypedPlan}; use crate::repr::{ColumnType, RelationDesc, RelationType}; @@ -348,13 +344,16 @@ impl TypedPlan { #[cfg(test)] mod test { + use std::collections::BTreeMap; + use bytes::BytesMut; use common_time::{DateTime, Interval}; use datatypes::prelude::ConcreteDataType; + use datatypes::value::Value; use pretty_assertions::assert_eq; use super::*; - use crate::expr::{DfScalarFunction, GlobalId, RawDfScalarFn}; + use crate::expr::{BinaryFunc, DfScalarFunction, GlobalId, RawDfScalarFn}; use crate::plan::{Plan, TypedPlan}; use crate::repr::{ColumnType, RelationType}; use crate::transform::test::{create_test_ctx, create_test_query_engine, sql_to_substrait}; diff --git a/src/flow/src/transform/plan.rs b/src/flow/src/transform/plan.rs index ffdec5a61446..ad5fc2f58dc2 100644 --- a/src/flow/src/transform/plan.rs +++ b/src/flow/src/transform/plan.rs @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::collections::{BTreeMap, BTreeSet, HashSet}; +use std::collections::HashSet; use itertools::Itertools; use snafu::OptionExt; @@ -23,9 +23,9 @@ use substrait_proto::proto::rel::RelType; use substrait_proto::proto::{plan_rel, Plan as SubPlan, ProjectRel, Rel}; use crate::error::{Error, InvalidQuerySnafu, NotImplementedSnafu, PlanSnafu, UnexpectedSnafu}; -use crate::expr::{MapFilterProject, ScalarExpr, TypedExpr, UnaryFunc}; -use crate::plan::{KeyValPlan, Plan, TypedPlan}; -use crate::repr::{self, RelationDesc, RelationType}; +use crate::expr::{MapFilterProject, TypedExpr}; +use crate::plan::{Plan, TypedPlan}; +use crate::repr::{self, RelationType}; use crate::transform::{substrait_proto, FlownodeContext, FunctionExtensions}; impl TypedPlan { @@ -235,7 +235,7 @@ mod test { use pretty_assertions::assert_eq; use super::*; - use crate::expr::{GlobalId, ScalarExpr}; + use crate::expr::GlobalId; use crate::plan::{Plan, TypedPlan}; use crate::repr::{ColumnType, RelationType}; use crate::transform::test::{create_test_ctx, create_test_query_engine, sql_to_substrait};