From 632061e3928b9ba66e79ebd385045386ce8176e4 Mon Sep 17 00:00:00 2001 From: zml1206 Date: Wed, 3 Jul 2024 17:28:24 +0800 Subject: [PATCH 1/2] [VL] RAS: Remove NoopFilter if has same output with child --- .../extension/columnar/enumerated/RemoveFilter.scala | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala index e2b8439fd218..4246a854c0af 100644 --- a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala +++ b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala @@ -41,9 +41,13 @@ object RemoveFilter extends RasRule[SparkPlan] { override def shift(node: SparkPlan): Iterable[SparkPlan] = { val filter = node.asInstanceOf[FilterExecTransformerBase] if (filter.isNoop()) { - val out = NoopFilter(filter.child, filter.output) - out.copyTagsFrom(filter) - return List(out) + if (filter.output == filter.child.output) { + return List(filter.child) + } else { + val out = NoopFilter(filter.child, filter.output) + out.copyTagsFrom(filter) + return List(out) + } } List.empty } From 68a019ca97d0d808007f17e749131eefa0376d12 Mon Sep 17 00:00:00 2001 From: zml1206 Date: Thu, 4 Jul 2024 10:51:50 +0800 Subject: [PATCH 2/2] update --- .../gluten/extension/columnar/enumerated/RemoveFilter.scala | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala index 4246a854c0af..8b8441e8d6ce 100644 --- a/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala +++ b/gluten-core/src/main/scala/org/apache/gluten/extension/columnar/enumerated/RemoveFilter.scala @@ -41,13 +41,12 @@ object RemoveFilter extends RasRule[SparkPlan] { override def shift(node: SparkPlan): Iterable[SparkPlan] = { val filter = node.asInstanceOf[FilterExecTransformerBase] if (filter.isNoop()) { - if (filter.output == filter.child.output) { - return List(filter.child) - } else { + if (filter.output != filter.child.output) { val out = NoopFilter(filter.child, filter.output) out.copyTagsFrom(filter) return List(out) } + return List(filter.child) } List.empty }