Hi,
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 ?



--
Sent from: http://apache-flink-user-mailing-list-archive.2336050.n4.nabble.com/

Reply via email to