[
https://issues.apache.org/jira/browse/FLINK-5776?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15885916#comment-15885916
]
ASF GitHub Bot commented on FLINK-5776:
---------------------------------------
Github user fhueske commented on a diff in the pull request:
https://github.com/apache/flink/pull/3418#discussion_r103226511
--- Diff:
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala
---
@@ -1562,6 +1561,39 @@ class CodeGenerator(
}
/**
+ * Adds a reusable constructor statement with the given parameter types,
+ * and the member variable's name that stores the variables passed in
the constructor.
+ *
+ * @param memberVariables The member variable's name that stores the
variables passed in
+ * the constructor.
+ * @param parameterTypes The parameter types to construct the function
+ */
+ def addReusableConstructorWithMemberVariables(
--- End diff --
This method is basically doing the same as `addReusableConstructor` except
that it allows to hardcode the names of the member variables. The same
functionality (in a safe manner) can be achieved by reusing existing code, IMO.
For instance, the code of the test could be rewritten to:
```
val params = generator.addReusableConstructor(classOf[Long])
val card = params(0)
val body =
s"""
|return java.lang.Long.valueOf(in1) +
java.lang.Long.valueOf($card);
""".stripMargin
```
We would have to remove the `null` assignment for the initially empty field
variable in `addReusableConstructor` though (or check if it is a primitive
type).
> Improve XXMapRunner support create instance by carrying constructor parameters
> ------------------------------------------------------------------------------
>
> Key: FLINK-5776
> URL: https://issues.apache.org/jira/browse/FLINK-5776
> Project: Flink
> Issue Type: Improvement
> Components: Table API & SQL
> Reporter: sunjincheng
> Assignee: sunjincheng
>
> At present, MapRunner FlatMapRunner only supports create non-parameter
> instance, but sometimes we need to carry constructor parameters to
> instantiate, so I would like to improve XXMapRunner support create instance
> by carrying constructor parameters.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)