apache kafka – ksqldb Session window generate magic null row

Today i test Windows in SQL queries and got strange behavior with Session window. I create new stream, new session table, and insert 1 row but in topic see 2 rows per 1 insert (1 with value null \ , see screenshot). What is problem ? Other options Hopping window and Tumbling window dont generate “magic null” row.

create stream:

CREATE STREAM MOVIE_TICKET_SALES2 (title VARCHAR, c INT)
    WITH (KAFKA_TOPIC='movie-ticket-sales2',
          PARTITIONS=1,
         VALUE_FORMAT='json');

create table with session:

  create table table_ses60sec2 as select title, count(*) from  MOVIE_TICKET_SALES2 window session (60 second) group by title;

insert:

 insert into MOVIE_TICKET_SALES2 values ('s', 1);
 insert into MOVIE_TICKET_SALES2 values ('s', 1);
 insert into MOVIE_TICKET_SALES2 values ('s', 1);

and select by print and select:

print  TABLE_SES60SEC2;

enter image description here

 select * from TABLE_ses60SEC2 emit changes;

enter image description here

Read more here: Source link