Pull query not returning data

I created a stream and table using ksqldb client
using

ksql> version;

Version: 0.20.0
CREATE STREAM enrichedeventsstream ( 
        key VARCHAR KEY,
        id VARCHAR,
        eventTitle VARCHAR,
        ...
        ...
    WITH (KAFKA_TOPIC='enrichedevents', PARTITIONS=8, VALUE_FORMAT='JSON');

and

CREATE TABLE enrichedevents ( 
        key VARCHAR PRIMARY KEY,
        id VARCHAR,
        eventTitle VARCHAR,
        ...

    WITH (KAFKA_TOPIC='enrichedevents', PARTITIONS=8, VALUE_FORMAT='JSON');

In both cases we can see data using pull queries;

select * from enrichedevents where key='500419843:3124' emit changes; 
select * from enrichedeventsstream emit changes;

I created a materialized view table:

CREATE TABLE enrichedevents_queryable AS
        SELECT key ,
        id,
        eventTitle from enrichedevents;

but when I try to query as

select * from enrichedevents_queryable where key='500419843:3124' ;

I get no data returned.

What am I doing wrong?

How much data do you have in your topic? After you created enrichedevents_queryable, how long did you wait before you issue the pull query – it might take some time until the query processed the input?

Also, are you sure that there is no later tombstone for the key? The push query (ie, the one with emit changes reads the full topic) and thus if there are two records <500419843:3124, someValue> and <500419843:3124,null> the push query would return the first record, too – in contrast, the persistent query would also process both record and thus delete the key when processing the tombstone and thus the pull query that goes against RocksDB won’t return anything.

Have you tried SELECT * FROM enrichedevents_queryable to see what records are in the table?

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