Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Address comments.
  • Loading branch information
viirya committed Dec 21, 2017
commit 53926ccb0795c09a90ba70a5c7862ec1cb126391
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ abstract class Expression extends TreeNode[Expression] {
private def reduceCodeSize(ctx: CodegenContext, eval: ExprCode): Unit = {
// TODO: support whole stage codegen too
if (eval.code.trim.length > 1024 && ctx.INPUT_ROW != null && ctx.currentVars == null) {
val setIsNull = if ("false" != s"${eval.isNull}" && "true" != s"${eval.isNull}") {
val setIsNull = if (!eval.isNull.isInstanceOf[LiteralValue]) {
val globalIsNull = ctx.addMutableState(ctx.JAVA_BOOLEAN, "globalIsNull")
val localIsNull = eval.isNull
eval.isNull = GlobalValue(globalIsNull)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ case class IsNull(child: Expression) extends UnaryExpression with Predicate {

override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
val eval = child.genCode(ctx)
val value = if ("true" == s"${eval.isNull}" || "false" == s"${eval.isNull}") {
val value = if (eval.isNull.isInstanceOf[LiteralValue]) {
LiteralValue(eval.isNull)
} else {
VariableValue(eval.isNull)
Expand Down Expand Up @@ -353,9 +353,9 @@ case class IsNotNull(child: Expression) extends UnaryExpression with Predicate {

override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
val eval = child.genCode(ctx)
val value = if ("true" == s"${eval.isNull}") {
val value = if (eval.isNull == LiteralValue("true")) {
LiteralValue("false")
} else if ("false" == s"${eval.isNull}") {
} else if (eval.isNull == LiteralValue("false")) {
LiteralValue("true")
} else {
StatementValue(s"(!(${eval.isNull}))")
Expand Down