You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by fhueske <gi...@git.apache.org> on 2017/10/02 21:11:46 UTC

[GitHub] flink pull request #4736: [FLINK-7371] [table] Add support for constant para...

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4736#discussion_r142247401
  
    --- Diff: flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/CodeGenerator.scala ---
    @@ -1670,4 +1670,34 @@ abstract class CodeGenerator(
     
         fieldTerm
       }
    +
    +  /**
    +    * Adds a reusable constant to the member area of the generated [[Function]].
    +    *
    +    * @param constant constant expression
    +    * @return member variable term
    +    */
    +  def addReusableBoxedConstant(constant: GeneratedExpression): String = {
    +    require(constant.literal, "Literal expected")
    +
    +    val fieldTerm = newName("constant")
    +
    +    val boxed = generateOutputFieldBoxing(constant)
    +    val boxedType = boxedTypeTermForTypeInfo(boxed.resultType)
    +
    +    val field =
    +      s"""
    +        |transient $boxedType $fieldTerm;
    --- End diff --
    
    why `transient`? Couldn't this be `final`?


---