Hi Aeden,

computed columns on a DataStrem input are currently not supported. I am currently working on making this possible. Have a look at FLIP-136 for more information [1].

However, you can simply add a projection before you register a view:

tEnv.createTemporaryView("myTable", dataStream);

tEnv.createTemporaryView(
    "myTableWithComputation",
    tEnv.sqlQuery("SELECT your_projection FROM myTable"))

I hope this helps.

Regards,
Timo


[1] https://cwiki.apache.org/confluence/display/FLINK/FLIP-136%3A++Improve+interoperability+between+DataStream+and+Table+API


On 18.01.21 09:09, Aeden Jameson wrote:
Hi

    How does one specify computed columns when converting a DataStream
to a temporary view? For example

         final DataStream<Message> stream = env.addSource(..);

         tEnv.createTemporaryView(
                 "myTable"
                 stream
                 ,$("col1")
                 ,$("col2")
                 ....
                 ,$("Do computed columns work here?")
         );

More specifically the compute expression i'd like to use involves
'case when.... then 1 else 0 end'


Reply via email to