From 35d9b20969eecbecb3f9277682b3be0b9441b371 Mon Sep 17 00:00:00 2001 From: Angerszhuuuu Date: Fri, 19 Jan 2024 14:35:53 +0800 Subject: [PATCH] [KYUUBI #5997][AUTHZ] Avoid unnecessary loop of RuleEliminateTypeOf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # :mag: Description ## Issue References ๐Ÿ”— This pull request fixes #5997 ## Describe Your Solution ๐Ÿ”ง Avoid unnecessary loop of RuleEliminateTypeOf, improve the catalyst performance ## Types of changes :bookmark: - [ ] Bugfix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) ## Test Plan ๐Ÿงช #### Behavior Without This Pull Request :coffin: #### Behavior With This Pull Request :tada: #### Related Unit Tests --- # Checklist ๐Ÿ“ - [ ] This patch was not authored or co-authored using [Generative Tooling](https://www.apache.org/legal/generative-tooling.html) **Be nice. Be informative.** Closes #5998 from AngersZhuuuu/KYUUBI-5997. Closes #5997 1db3b5f95 [Angerszhuuuu] [KYUUBI #5997][Improvement] Avoid unnecessary loop of RuleEliminateTypeOf Authored-by: Angerszhuuuu Signed-off-by: Cheng Pan --- .../plugin/spark/authz/rule/RuleEliminateTypeOf.scala | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/RuleEliminateTypeOf.scala b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/RuleEliminateTypeOf.scala index 0f3ae136c4a..668f45fbd37 100644 --- a/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/RuleEliminateTypeOf.scala +++ b/extensions/spark/kyuubi-spark-authz/src/main/scala/org/apache/kyuubi/plugin/spark/authz/rule/RuleEliminateTypeOf.scala @@ -25,10 +25,8 @@ import org.apache.kyuubi.plugin.spark.authz.rule.expression.TypeOfPlaceHolder object RuleEliminateTypeOf extends Rule[LogicalPlan] { override def apply(plan: LogicalPlan): LogicalPlan = { - plan.transformUp { case p => - p.transformExpressionsUp { - case toph: TypeOfPlaceHolder => TypeOf(toph.expr) - } + plan.transformExpressionsUp { + case toph: TypeOfPlaceHolder => TypeOf(toph.expr) } } }