Github user yjshen commented on the pull request:
https://github.com/apache/flink/pull/1880#issuecomment-209954946
I happened to have context here for `primitiveDefaultValue`, I think this
was originated from Apache Spark's counterpart for create default values for an
expression. Let me summarize how it is used to calculate scalar expression's
result in Spark:
```
boolean ${result.isNull} = false;
$javaType ${result.value} = ${ctx.defaultValue(type)};
if (result is not null for some input) {
${result.value} = calculated result;
} else {
${result.isNull} = true;
}
```
Therefore, after the evaluation of this expression, if the result is Null,
the `isNull` field is set to `True` and no more touches on `value` field, if
not null, the `result.value` point to the final result. The default value is
never used.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---