Skip to content

Commit

Permalink
chore: after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
discord9 committed Aug 15, 2024
1 parent c83c19a commit c2534c6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/flow/src/expr/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
18 changes: 4 additions & 14 deletions src/flow/src/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)*) => {
Expand Down Expand Up @@ -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};
Expand All @@ -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();
Expand Down
11 changes: 5 additions & 6 deletions src/flow/src/transform/aggr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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};
Expand Down Expand Up @@ -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};
Expand Down
10 changes: 5 additions & 5 deletions src/flow/src/transform/plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit c2534c6

Please sign in to comment.