Github user dongjoon-hyun commented on a diff in the pull request:
https://github.com/apache/spark/pull/21850#discussion_r205215698
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/expressions.scala
---
@@ -414,6 +414,9 @@ object SimplifyConditionals extends Rule[LogicalPlan]
with PredicateHelper {
// these branches can be pruned away
val (h, t) = branches.span(_._1 != TrueLiteral)
CaseWhen( h :+ t.head, None)
+
+ case CaseWhen((cond, branchValue) :: Nil, elseValue) =>
+ If(cond, branchValue, elseValue.getOrElse(Literal(null,
branchValue.dataType)))
--- End diff --
Also, `CaseWhen` has additional `project_project_value_0_0` at outside.
```
/* 006 */ final class GeneratedIteratorForCodegenStage1 extends
org.apache.spark.sql.execution.BufferedRowIterator {
/* 007 */ private Object[] references;
/* 008 */ private scala.collection.Iterator[] inputs;
/* 009 */ private scala.collection.Iterator inputadapter_input_0;
/* 010 */ private int project_project_value_0_0;
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]