File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ abstract class Expression extends TreeNode[Expression] {
118118 private def reduceCodeSize (ctx : CodegenContext , eval : ExprCode ): Unit = {
119119 // TODO: support whole stage codegen too
120120 if (eval.code.trim.length > 1024 && ctx.INPUT_ROW != null && ctx.currentVars == null ) {
121- val setIsNull = if (" false " != s " ${ eval.isNull} " && " true " != s " ${eval.isNull} " ) {
121+ val setIsNull = if (! eval.isNull. isInstanceOf [ LiteralValue ] ) {
122122 val globalIsNull = ctx.addMutableState(ctx.JAVA_BOOLEAN , " globalIsNull" )
123123 val localIsNull = eval.isNull
124124 eval.isNull = GlobalValue (globalIsNull)
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ case class IsNull(child: Expression) extends UnaryExpression with Predicate {
322322
323323 override def doGenCode (ctx : CodegenContext , ev : ExprCode ): ExprCode = {
324324 val eval = child.genCode(ctx)
325- val value = if (" true " == s " ${ eval.isNull} " || " false " == s " ${eval.isNull} " ) {
325+ val value = if (eval.isNull. isInstanceOf [ LiteralValue ] ) {
326326 LiteralValue (eval.isNull)
327327 } else {
328328 VariableValue (eval.isNull)
@@ -353,9 +353,9 @@ case class IsNotNull(child: Expression) extends UnaryExpression with Predicate {
353353
354354 override def doGenCode (ctx : CodegenContext , ev : ExprCode ): ExprCode = {
355355 val eval = child.genCode(ctx)
356- val value = if (" true " == s " ${eval.isNull} " ) {
356+ val value = if (eval.isNull == LiteralValue ( " true " ) ) {
357357 LiteralValue (" false" )
358- } else if (" false " == s " ${eval.isNull} " ) {
358+ } else if (eval.isNull == LiteralValue ( " false " ) ) {
359359 LiteralValue (" true" )
360360 } else {
361361 StatementValue (s " (!( ${eval.isNull})) " )
You can’t perform that action at this time.
0 commit comments