2
tableEnv.fromDataStream(xxxStream).addColumns('processTime.proctime)

The above code will throw excetion:

org.apache.flink.table.api.ValidationException: Window properties can only be used on windowed tables.

but this will works

tableEnv.fromDataStream(xxxStream, 'id,  ......, 'processTime.proctime)

But I must repeat all the columns in this way.

xiemeilong
  • 643
  • 1
  • 6
  • 21

2 Answers2

0

Found some workaround for that, not sure if it could be done easier though:

Table tmpTable = tableEnv.fromDataStream(my_pojo_datastream);
Schema newSchema = Schema.newBuilder()
   .fromResolvedSchema(tmpTable.getResolvedSchema())
   .columnByExpression("proc_time", "PROCTIME()")
   .build();

Table tmpTableWithProcTIme = tableEnv.fromDataStream(my_pojo_datastream, newSchema);
0

Below code worked for me

Table tmpTable = tableEnv.fromDataStream(my_pojo_datastream,
          Schema.newBuilder().columnByExpression("proc_time", "PROCTIME()").build());