From 023f2f709db484d82cde22b00db0bad33ac72279 Mon Sep 17 00:00:00 2001 From: KaiXinXiaoLei <584620569@qq.com> Date: Thu, 1 Mar 2018 08:55:37 +0800 Subject: [PATCH] change code according to review --- .../sql/catalyst/plans/logical/QueryPlanConstraints.scala | 8 +------- .../optimizer/InferFiltersFromConstraintsSuite.scala | 3 +-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala index 5d3d44896c818..4d59ebba228d5 100644 --- a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala +++ b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/QueryPlanConstraints.scala @@ -26,15 +26,9 @@ trait QueryPlanConstraints { self: LogicalPlan => * An [[ExpressionSet]] that contains an additional set of constraints, such as equality * constraints and `isNotNull` constraints, etc. */ - lazy val allConstraints: ExpressionSet = { - if (conf.constraintPropagationEnabled) { - ExpressionSet(validConstraints + lazy val allConstraints: ExpressionSet = ExpressionSet(validConstraints .union(inferAdditionalConstraints(validConstraints)) .union(constructIsNotNullConstraints(validConstraints))) - } else { - ExpressionSet(Set.empty) - } - } /** * An [[ExpressionSet]] that contains invariants about the rows output by this operator. For diff --git a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/InferFiltersFromConstraintsSuite.scala b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/InferFiltersFromConstraintsSuite.scala index 2d2ce9e50cac0..f78c2356e35a5 100644 --- a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/InferFiltersFromConstraintsSuite.scala +++ b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/InferFiltersFromConstraintsSuite.scala @@ -200,8 +200,7 @@ class InferFiltersFromConstraintsSuite extends PlanTest { val originalQuery = x.join(y, LeftSemi, condition).analyze val left = x.where(IsNotNull('a)) val right = y.where(IsNotNull('a)) - val correctAnswer = left.join(right, LeftSemi, condition) - .analyze + val correctAnswer = left.join(right, LeftSemi, condition).analyze val optimized = Optimize.execute(originalQuery) comparePlans(optimized, correctAnswer) }