You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Fabian Hueske (JIRA)" <ji...@apache.org> on 2017/10/28 19:39:00 UTC

[jira] [Created] (FLINK-7939) DataStream of atomic type cannot be converted to Table with time attributes

Fabian Hueske created FLINK-7939:
------------------------------------

             Summary: DataStream of atomic type cannot be converted to Table with time attributes
                 Key: FLINK-7939
                 URL: https://issues.apache.org/jira/browse/FLINK-7939
             Project: Flink
          Issue Type: Bug
          Components: Table API & SQL
    Affects Versions: 1.4.0, 1.3.3
            Reporter: Fabian Hueske
            Assignee: Fabian Hueske
             Fix For: 1.4.0, 1.3.3


A DataStream of an atomic type, such as {{DataStream<String>}} or {{DataStream<Long>}} cannot be converted into a {{Table}} with a time attribute.

{code}
DataStream<String> stream = ...
Table table = tEnv.fromDataStream(stream, "string, rowtime.rowtime")
{code}

yields

{code}
Exception in thread "main" org.apache.flink.table.api.TableException: Field reference expression requested.
    at org.apache.flink.table.api.TableEnvironment$$anonfun$1.apply(TableEnvironment.scala:630)
    at org.apache.flink.table.api.TableEnvironment$$anonfun$1.apply(TableEnvironment.scala:624)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
    at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:241)
    at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
    at scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
    at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:241)
    at scala.collection.mutable.ArrayOps$ofRef.flatMap(ArrayOps.scala:186)
    at org.apache.flink.table.api.TableEnvironment.getFieldInfo(TableEnvironment.scala:624)
    at org.apache.flink.table.api.StreamTableEnvironment.registerDataStreamInternal(StreamTableEnvironment.scala:398)
    at org.apache.flink.table.api.scala.StreamTableEnvironment.fromDataStream(StreamTableEnvironment.scala:85)
{code}

As a workaround the atomic type can be wrapped in {{Tuple1}}, i.e., convert a {{DataStream<String>}} into a {{DataStream<Tuple1<String>>}}.



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