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

    https://github.com/apache/flink/pull/5367#discussion_r164266898
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/ScalarOperators.scala
 ---
    @@ -984,6 +987,63 @@ object ScalarOperators {
         }
       }
     
    +  def generateDot(codeGenerator: CodeGenerator,
    +                  dot: RexCall,
    +                  record: GeneratedExpression,
    +                  subField: GeneratedExpression)
    +  : GeneratedExpression = {
    +    val nullTerm = newName("isNull")
    +    val resultTerm = newName("result")
    +    val resultType = FlinkTypeFactory.toTypeInfo(dot.getType)
    +    val resultTypeTerm = boxedTypeTermForTypeInfo(resultType)
    +    dot.operands.get(0).getType match {
    +      case crdt: CompositeRelDataType => {
    +        val fieldName = dot.operands.get(1).asInstanceOf[RexLiteral]
    +          .getValue.asInstanceOf[NlsString].getValue
    +        if (crdt.compositeType.isInstanceOf[TupleTypeInfo[_]]) {
    +           return GeneratedExpression(resultTerm, nullTerm,
    +            s"""
    +                   |${record.code}
    +                   |${subField.code}
    +                   |${resultTypeTerm} $resultTerm =
    +                   |  (${resultTypeTerm}) 
${record.resultTerm}.productElement(
    +                   |    ${fieldName.substring(1).toInt} - 1);
    +                   |boolean $nullTerm =${resultTerm} == null;
    +                   |""".stripMargin, resultType)
    +        } else if (crdt.compositeType.isInstanceOf[CaseClassTypeInfo[_]]) {
    +          return GeneratedExpression(resultTerm, nullTerm,
    +            s"""
    +               |${record.code}
    +               |${resultTypeTerm} $resultTerm =
    +               |  (${resultTypeTerm}) ${record.resultTerm}.${fieldName}();
    --- End diff --
    
    NPE will be thrown 


---

Reply via email to