Create table as select produces null values

Hi all,

I´ve created a ktable that is producing null value fields from a stream.

The stream

CREATE STREAM stream_x ("atm" INTEGER, "sins" VARCHAR, "ins_no" VARCHAR, "zip" VARCHAR, "ins_dt_t" VARCHAR) WITH (kafka_topic='origin.topic', value_format='AVRO');

the table

CREATE TABLE table_x WITH (KAFKA_TOPIC='table_x', PARTITIONS=1, REPLICAS=1, value_format='AVRO') AS SELECT table_x.sins, LATEST_BY_OFFSET(table_x.ins_dt_t),LATEST_BY_OFFSET(table_x.zip),LATEST_BY_OFFSET(table_x.ins_no) FROM table_x GROUP BY table_x.sins EMIT CHANGES;

and the contain of the ktable

+--------------------------------+--------------------------------+--------------------------------+------------- 
-------------------+--------------------------------+--------------------------------+
|ROWTIME                         |ROWKEY                          |SINS                            |INS_DT_T                        |ZIP                             |INS_NO                          |
+--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+--------------------------------+
|1618839693624                   |13345303                        |13345303                        |null                            |null                            |null                            |
|1618839693624                   |13345314                        |13345314                        |null                            |null                            |null                            |
|1618839693624                   |13345336                        |13345336                        |null                            |null                            |null                            |
|1618839693624                   |13345265                        |13345265                        |null                            |null                            |null                            |
|1618839693624                   |13345381                        |13345381                        |null                            |null                            |null                            |
|1618839693624                   |13345294                        |13345294                        |null                            |null                            |null                            |

The stream is receiving events but something is happening with the create table as select sentence.

hmm are you creating the table as select from the table itself?

CREATE TABLE
table_x
WITH (KAFKA_TOPIC='table_x', PARTITIONS=1, REPLICAS=1, value_format='AVRO') AS SELECT table_x.sins, LATEST_BY_OFFSET(table_x.ins_dt_t),LATEST_BY_OFFSET(table_x.zip),LATEST_BY_OFFSET(table_x.ins_no) FROM
table_x
GROUP BY table_x.sins EMIT CHANGES;

Sorry, It was a mistake when c&p. The table is like this

CREATE TABLE table_x WITH (KAFKA_TOPIC='table_x', PARTITIONS=1, REPLICAS=1, value_format='AVRO') AS SELECT table_x.sins, LATEST_BY_OFFSET(table_x.ins_dt_t),LATEST_BY_OFFSET(table_x.zip),LATEST_BY_OFFSET(table_x.ins_no) FROM stream_x GROUP BY table_x.sins EMIT CHANGES;

so I guess you’re receiving data for “ZIP” or “INS_NO”?
and wonder why they are not showing up querying the table?

This topic was automatically closed after 30 days. New replies are no longer allowed.