MCPcopy Create free account
hub / github.com/apache/datafusion / rewrite

Method rewrite

datafusion/optimizer/src/eliminate_join.rs:49–68  ·  view source on GitHub ↗
(
        &self,
        plan: LogicalPlan,
        _config: &dyn OptimizerConfig,
    )

Source from the content-addressed store, hash-verified

47 }
48
49 fn rewrite(
50 &self,
51 plan: LogicalPlan,
52 _config: &dyn OptimizerConfig,
53 ) -> Result<Transformed<LogicalPlan>> {
54 match plan {
55 LogicalPlan::Join(join) if join.join_type == Inner && join.on.is_empty() => {
56 match join.filter {
57 Some(Expr::Literal(ScalarValue::Boolean(Some(false)), _)) => Ok(
58 Transformed::yes(LogicalPlan::EmptyRelation(EmptyRelation {
59 produce_one_row: false,
60 schema: join.schema,
61 })),
62 ),
63 _ => Ok(Transformed::no(LogicalPlan::Join(join))),
64 }
65 }
66 _ => Ok(Transformed::no(plan)),
67 }
68 }
69
70 fn supports_rewrite(&self) -> bool {
71 true

Callers

nothing calls this directly

Calls 3

EmptyRelationClass · 0.85
JoinClass · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected