Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/1624#discussion_r52740335
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/api/table/codegen/CodeGenerator.scala
---
@@ -231,29 +252,40 @@ class CodeGenerator(
* be reused, they will be added to reusable code sections internally.
The evaluation result
* may be stored in the global result variable (see [[outRecordTerm]]).
*
- * @param fieldExprs
+ * @param fieldExprs field expressions to be converted
* @param returnType conversion target type. Type must have the same
arity than fieldExprs.
+ * @param resultFieldNames result field names necessary for a mapping
to POJO fields.
* @return instance of GeneratedExpression
*/
def generateResultExpression(
fieldExprs: Seq[GeneratedExpression],
- returnType: TypeInformation[_ <: Any])
+ returnType: TypeInformation[_ <: Any],
+ resultFieldNames: Seq[String])
: GeneratedExpression = {
- // TODO disable arity check for Rows and derive row arity from
fieldExprs
// initial type check
if (returnType.getArity != fieldExprs.length) {
throw new CodeGenException("Arity of result type does not match
number of expressions.")
}
// type check
returnType match {
+ case pt: PojoTypeInfo[_] =>
+ fieldExprs.zipWithIndex foreach {
--- End diff --
Add a check that both `fieldExpr` and `resultFieldName` have the same
length.
---
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.
---