File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import org.scalatest.prop.GeneratorDrivenPropertyChecks
2525import org .apache .spark .{SparkConf , SparkFunSuite }
2626import org .apache .spark .serializer .JavaSerializer
2727import org .apache .spark .sql .catalyst .{CatalystTypeConverters , InternalRow }
28- import org .apache .spark .sql .catalyst .analysis .ResolveTimeZone
28+ import org .apache .spark .sql .catalyst .analysis .{ ResolveTimeZone , SimpleAnalyzer }
2929import org .apache .spark .sql .catalyst .expressions .codegen ._
3030import org .apache .spark .sql .catalyst .optimizer .SimpleTestOptimizer
3131import org .apache .spark .sql .catalyst .plans .logical .{OneRowRelation , Project }
@@ -188,7 +188,9 @@ trait ExpressionEvalHelper extends GeneratorDrivenPropertyChecks {
188188 expected : Any ,
189189 inputRow : InternalRow = EmptyRow ): Unit = {
190190 val plan = Project (Alias (expression, s " Optimized( $expression) " )() :: Nil , OneRowRelation ())
191- val optimizedPlan = SimpleTestOptimizer .execute(plan)
191+ // We should analyze the plan first, otherwise we possibly optimize an unresolved plan.
192+ val analyzedPlan = SimpleAnalyzer .execute(plan)
193+ val optimizedPlan = SimpleTestOptimizer .execute(analyzedPlan)
192194 checkEvaluationWithoutCodegen(optimizedPlan.expressions.head, expected, inputRow)
193195 }
194196
You can’t perform that action at this time.
0 commit comments