Skip to content

Conversation

@unsleepy22
Copy link

No description provided.

@unsleepy22 unsleepy22 changed the title [Flink 4130] CallGenerator could generate illegal code when taking no operands [Flink-4130] CallGenerator could generate illegal code when taking no operands Jun 29, 2016
operands.map(_.nullTerm).mkString(" || ")
} else {
nullCheck + ""
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that when operands.size == 0 and nullCheck is enable, the $nullTerm will always be true, which means $resultTerm always be the default value. That may be wrong.

@unsleepy22
Copy link
Author

@wuchong although I agree this bug could be fixed by adding operands.nonEmpty, there is a problem in generated code, specifically, an undeclared variable will be generated like this:

long result$16 = 
((org.apache.flink.api.java.table.TumblingWindowUDf)
udfDict.get("tumblingWin")).
  eval()
           ;

if (isNull$17) {
  out.setField(1, null);
}
else {
  out.setField(1, result$16);
}

I guess it's generated in GeneratedExpression, for simplicity I reverted my change.

@wuchong
Copy link
Member

wuchong commented Jun 30, 2016

Yea... the isNull$17 is not declared if we do what I said above, and of course will throw compile error.

The code looks good to me now, although it looks a little weird that $nullTerm always be false.

@twalthr
Copy link
Contributor

twalthr commented Jul 19, 2016

Thanks for the contribution @unsleepy22.
I changed the code a little bit, so that we can prevent an if(false) branch.

Will merge...

@asfgit asfgit closed this in dd53831 Jul 19, 2016
hequn8128 pushed a commit to hequn8128/flink that referenced this pull request Jun 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants