twalthr commented on a change in pull request #7177: [FLINK-7599] [table]
Support for aggregates in MATCH_RECOGNIZE
URL: https://github.com/apache/flink/pull/7177#discussion_r238713688
##########
File path:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/MatchCodeGenerator.scala
##########
@@ -533,45 +618,49 @@ class MatchCodeGenerator(
reusablePerRecordStatements += codeForAgg
val defaultValue = primitiveDefaultValue(singleResultType)
- val codeForSingleAgg =
+ val codeForSingleAgg = if (nullCheck) {
j"""
|boolean $singleResultNullTerm;
- |$singleResultTypeTerm $singleResultTerm = ($singleResultTypeTerm)
$resultRowTerm
- | .getField(${aggregates.size});
- |if ($singleResultTerm != null) {
+ |$primitiveSingleResultTypeTerm $singleResultTerm;
+ |if ($resultRowTerm.getField(${aggregates.size}) != null) {
+ | $singleResultTerm = ($boxedSingleResultTypeTerm) $resultRowTerm
+ | .getField(${aggregates.size});
| $singleResultNullTerm = false;
|} else {
| $singleResultNullTerm = true;
| $singleResultTerm = $defaultValue;
|}
|""".stripMargin
+ } else {
+ j"""
+ |boolean $singleResultNullTerm = false;
Review comment:
This line can be dropped. The null term is not evaluated if nullCheck is
disabled.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services