Hi David,

I think the problem is that the type of the DataStream produced by the TableSource, does not match the type that is declared in the ` getReturnType()`. A `MapFunction<xxx, Row>` is always a generic type (because Row cannot be analyzed). A solution would be that the mapper implements `ResultTypeQueryable`. I agree that the error should be thrown earlier, not in the CodeGenerator. Can you create an issue for this?

Btw the Table API supports nested types, it should work that the TableSource returns ` SongEvent`.

Regards,
Timo


Am 09.06.17 um 20:19 schrieb Dawid Wysakowicz:
Sorry forgot to add the link:

https://gist.github.com/dawidwys/537d12a6f2355cba728bf93f1af87b45

Z pozdrowieniami! / Cheers!


Dawid Wysakowicz

*Data/Software Engineer*

Skype: dawid_wys | Twitter: @OneMoreCoder

<http://getindata.com/>


2017-06-09 20:19 GMT+02:00 Dawid Wysakowicz <wysakowicz.da...@gmail.com <mailto:wysakowicz.da...@gmail.com>>:

    Hi,
    I tried writing a simple sql query with custom StreamTableSource
    and it fails with error:

            org.apache.flink.table.codegen.CodeGenException: Arity of
            result type does not match number of expressions.

            at
            
org.apache.flink.table.codegen.CodeGenerator.generateResultExpression(CodeGenerator.scala:940)

            at
            
org.apache.flink.table.codegen.CodeGenerator.generateConverterResultExpression(CodeGenerator.scala:883)

            at
            
org.apache.flink.table.plan.nodes.CommonScan$class.generatedConversionFunction(CommonScan.scala:57)

            at
            
org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.generatedConversionFunction(StreamTableSourceScan.scala:35)

            at
            
org.apache.flink.table.plan.nodes.datastream.StreamScan$class.convertToInternalRow(StreamScan.scala:48)

            at
            
org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.convertToInternalRow(StreamTableSourceScan.scala:35)

            at
            
org.apache.flink.table.plan.nodes.datastream.StreamTableSourceScan.translateToPlan(StreamTableSourceScan.scala:107)


    You can check the source code here:

    Z pozdrowieniami! / Cheers!


    Dawid Wysakowicz

    *Data/Software Engineer*

    Skype: dawid_wys | Twitter: @OneMoreCoder

    <http://getindata.com/>



Reply via email to