You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jark Wu (JIRA)" <ji...@apache.org> on 2017/01/16 09:23:26 UTC

[jira] [Commented] (FLINK-5500) Error when created array literals

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

Jark Wu commented on FLINK-5500:
--------------------------------

Hi [~Yuhong_kyo] ,  sorry, I can't reproduce your errors in my local machine. Did you upgrade Calcite to 1.11 or dependency to a newer Calcite  ? 

> Error when created array literals 
> ----------------------------------
>
>                 Key: FLINK-5500
>                 URL: https://issues.apache.org/jira/browse/FLINK-5500
>             Project: Flink
>          Issue Type: Bug
>          Components: Table API & SQL
>    Affects Versions: 1.2.0
>            Reporter: Yuhong Hong
>
> It will report error when i create an array literals on TableAPI or SQL.
> TableAPI:
> dataStream.toTable(tEnv).select("array(1,2,3)")
> The complete stacktrace looks like:
> {code:java}
> Exception in thread "main" org.apache.flink.table.api.TableException: Result field does not match expected type. Expected: int[]; Actual: ObjectArrayTypeInfo<Integer>
> 	at org.apache.flink.table.typeutils.TypeConverter$.determineReturnType(TypeConverter.scala:109)
> 	at org.apache.flink.table.plan.nodes.datastream.DataStreamCalc.translateToPlan(DataStreamCalc.scala:79)
> 	at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:340)
> 	at org.apache.flink.table.api.StreamTableEnvironment.translate(StreamTableEnvironment.scala:322)
> 	at org.apache.flink.table.api.scala.StreamTableEnvironment.toDataStream(StreamTableEnvironment.scala:142)
> 	at org.apache.flink.table.api.scala.TableConversions.toDataStream(TableConversions.scala:52)
> 	at com.huawei.example.flink.SimpleSql$.main(SimpleSql.scala:77)
> 	at com.huawei.example.flink.SimpleSql.main(SimpleSql.scala)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:498)
> 	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
> {code}
> SQL:
> tEnv.sql( "select ARRAY\[1,2,3\]  FROM  OrderA ")
> {code:java}
> Exception in thread "main" org.apache.flink.table.api.TableException: Type is not supported: ARRAY
> 	at org.apache.flink.table.api.TableException$.apply(exceptions.scala:51)
> 	at org.apache.flink.table.calcite.FlinkTypeFactory$.toTypeInfo(FlinkTypeFactory.scala:227)
> 	at org.apache.flink.table.plan.logical.LogicalRelNode$$anonfun$15.apply(operators.scala:516)
> 	at org.apache.flink.table.plan.logical.LogicalRelNode$$anonfun$15.apply(operators.scala:515)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
> 	at scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:244)
> 	at scala.collection.Iterator$class.foreach(Iterator.scala:727)
> 	at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
> 	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
> 	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
> 	at scala.collection.TraversableLike$class.map(TraversableLike.scala:244)
> 	at scala.collection.AbstractTraversable.map(Traversable.scala:105)
> 	at org.apache.flink.table.plan.logical.LogicalRelNode.<init>(operators.scala:515)
> 	at org.apache.flink.table.api.StreamTableEnvironment.sql(StreamTableEnvironment.scala:183)
> 	at com.huawei.example.flink.SimpleSql$.main(SimpleSql.scala:62)
> {code}
> The calcite parse the sql and will translate the array to type ArraySqlType, but the toTypeInfo in FlinkTypeFactory just support ArrayRelType.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)