-
Notifications
You must be signed in to change notification settings - Fork 333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove unnecessary traits and wrapper types from the query crate #3884
Comments
@evenyag i want to pr LogicalPlan part.I took a rough look. Is it to delete the query::plan file and replace all query::plan::LogicalPlan with datafusion_expr::LogicalPlan? |
We can still keep the |
Could you please help me check if this modification meets your means? before: pub fn schema(&self) -> Result<Schema> {
match self {
Self::DfPlan(plan) => {
let df_schema = plan.schema();
df_schema
.clone()
.try_into()
.context(ConvertDatafusionSchemaSnafu)
}
}
} after: pub fn schema(&self, plan: &DfLogicalPlan) -> Result<Schema> {
let df_schema = plan.schema();
df_schema.clone()
.try_into()
.context(ConvertDatafusionSchemaSnafu)
} |
You should remove fn plan_schema(plan: &DfLogicalPlan) -> Result<Schema> {
let df_schema = plan.schema();
df_schema.clone()
.try_into()
.context(ConvertDatafusionSchemaSnafu)
} I also renamed the function to |
@evenyag Remove the remaining 3 traits:
|
What type of enhancement is this?
Refactor
What does the enhancement do?
We defined some wrapper types and traits for the query engine
Most implementations simply forward requests to datafusion. Since we are highly coupled with datafusion and have no plan to support another query engine, we could remove these types.
Implementation challenges
For
Expr
:greptimedb/src/common/query/src/logical_plan/expr.rs
Lines 22 to 27 in d997463
We could simply remove the
Expr
and re-export datafusion'sExpr
The
LogicalPlan
only has one variant so we can replace it with datafusion'sLogicalPlan
. But we also need to refactor methods of the enum so they can take datafusion'sLogicalPlan
as input.greptimedb/src/query/src/plan.rs
Lines 35 to 38 in d997463
We could also remove adapters like the
DfPhysicalPlanAdapter
if we remove thePhysicalPlan
.Many places use
Expr
,LogicalPlan
, andPhysicalPlan
. We might need to refactor them in different PRs.The text was updated successfully, but these errors were encountered: