0

Hello i have a Model with many fields

public class UserModel {
    public int userId;
    public int count;
    public int zip;
    public LocalDateTime dt;
    public LocalDateTime wStart;
    public LocalDateTime wEnd;

}

I work with table, select fields and convert Table to DataStream by Model. But problem what i should select all fields if I don't even need it or i will get exception

Column types of query result and sink for do not match. Cause: Different number of columns.

And I just have to substitute fake data for the plugs...

    Table win = (...)
.select($("userId"), $("count").sum().as("count"), $("w").start().as("wStart"), $("w").end().as("wEnd"), $("w").end().as("dt"), $("userId").as("zip"));
       
    DataStream<UserModel> dataStream = te.toDataStream(win, UserModel.class);

How can I select only need me fields with Model with many fields and the other fields are initialized by default?

like this:

 .select($("userId"), $("count").sum().as("count"));
 DataStream<UserModel> dataStream = te.toDataStream(win, UserModel.class);
padavan
  • 714
  • 8
  • 22
  • or there is no such a possibility and it is necessary to do one more step? for example how to return Row and then through Map convert to your model ? – padavan Apr 26 '23 at 23:11

0 Answers0