Tejas Budukh created FLINK-22660:
------------------------------------
Summary: Incorrect flink documentation example
Key: FLINK-22660
URL: https://issues.apache.org/jira/browse/FLINK-22660
Project: Flink
Issue Type: Bug
Components: Documentation, Examples
Affects Versions: 1.13.0
Reporter: Tejas Budukh
I was trying out examples given
[here|https://ci.apache.org/projects/flink/flink-docs-release-1.13/docs/dev/table/data_stream_api/#examples-for-fromdatastream]
to convert Datastream to Table and one of the example gives out error.
My code is as follows :
_StreamExecutionEnvironment env =
StreamExecutionEnvironment.getExecutionEnvironment();_
_DataStream<User> dataStream =_
_env.fromElements(_
_new User("Alice", 4, Instant.ofEpochMilli(1000)),_
_new User("Bob", 6, Instant.ofEpochMilli(1001)),_
_new User("Alice", 10, Instant.ofEpochMilli(1002)))_
_.assignTimestampsAndWatermarks(WatermarkStrategy.<User>forBoundedOutOfOrderness(Duration.ofSeconds(60)));_
_StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env);_
_Table table =_
_tableEnv.fromDataStream(_
_dataStream,_
_Schema.newBuilder()_
_.column("event_time", "TIMESTAMP(3)")_
_.column("name", "STRING")_
_.column("score", "INT")_
_.watermark("event_time", "SOURCE_WATERMARK()")_
_.build());_
_table.printSchema();_
_table.select($("*")).execute().print();_
and the error I got is :
_Caused by: org.codehaus.commons.compiler.CompileException: Line 13, Column
103: Cannot cast "java.time.Instant" to "java.time.LocalDateTime"_
_at
org.codehaus.janino.UnitCompiler.compileError(UnitCompiler.java:12211)_
_at
org.codehaus.janino.UnitCompiler.compileGet2(UnitCompiler.java:5051)_
_at org.codehaus.janino.UnitCompiler.access$8600(UnitCompiler.java:215)_
_at
org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4418)_
_at
org.codehaus.janino.UnitCompiler$16.visitCast(UnitCompiler.java:4396)_
_at org.codehaus.janino.Java$Cast.accept(Java.java:4898)_
_at org.codehaus.janino.UnitCompiler.compileGet(UnitCompiler.java:4396)_
Can somebody help with this ?
--
This message was sent by Atlassian Jira
(v8.3.4#803005)