[ 
https://issues.apache.org/jira/browse/FLINK-8104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16262872#comment-16262872
 ] 

ASF GitHub Bot commented on FLINK-8104:
---------------------------------------

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

    https://github.com/apache/flink/pull/5040#discussion_r152588446
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/ScalarOperators.scala
 ---
    @@ -835,6 +836,43 @@ object ScalarOperators {
         generateUnaryArithmeticOperator(operator, nullCheck, 
operand.resultType, operand)
       }
     
    +  def generateRow(
    +      codeGenerator: CodeGenerator,
    +      resultType: TypeInformation[_],
    +      elements: Seq[GeneratedExpression])
    +  : GeneratedExpression = {
    +    val rowTerm = codeGenerator.addReusableRow(resultType.getArity, 
elements.size)
    +
    +    val boxedElements: Seq[GeneratedExpression] = resultType match {
    +      case ct: CompositeType[_] =>
    +        elements.zipWithIndex.map{
    +          case (e, idx) =>
    +            val boxedTypeTerm = boxedTypeTermForTypeInfo(ct.getTypeAt(idx))
    --- End diff --
    
    Can we put this into a private helper method? I think it is the same code 
for `generateArray`, `generateMap`, and `generateRow`.


> Fix Row value constructor
> -------------------------
>
>                 Key: FLINK-8104
>                 URL: https://issues.apache.org/jira/browse/FLINK-8104
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table API & SQL
>            Reporter: Rong Rong
>            Assignee: Rong Rong
>
> Support Row value constructor which is currently broken. 
> See 
> {code:java}
> // 
> flink-libraries/flink-table/src/test/scala/org/apache/flink/table/expressions/SqlExpressionTest.scala
>   @Test
>   def testValueConstructorFunctions(): Unit = {
>     // TODO we need a special code path that flattens ROW types
>     // testSqlApi("ROW('hello world', 12)", "hello world") // test base only 
> returns field 0
>     // testSqlApi("('hello world', 12)", "hello world") // test base only 
> returns field 0
>     // ...
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to