Hi all
Strange thing
I generate messages with the following structure
{
"INVNUMBER": "7f1108a1-6d25-4776-a815-0d7d7e332e14",
"SALEDATETIME": "2024-07-02T16:25:25.269+02:00",
"SALETIMESTAMP": "1719930325269",
"TERMINALPOINT": "13",
"NETT": 1721.94,
"VAT": 241.07,
"TOTAL": 1963.01,
"STORE": {
"ID": "324213441",
"NAME": "Milnerton"
},
"CLERK": {
"ID": "10014",
"NAME": "Winston"
},
"BASKETITEMS": [
{
"ID": "000000014",
"NAME": "Coca-Cola Soft Drink 1.5L",
"BRAND": "Coka Coke",
"CATEGORY": "Beverage",
"PRICE": 18.49,
"QUANTITY": 2
},
{
"ID": "000000038",
"NAME": "PnP Full Cream Fresh Milk 2L",
"BRAND": "PnP",
"CATEGORY": "Food Cupboard",
"PRICE": 34.99,
"QUANTITY": 3
}
],
"FINTRANSACTIONID": "577d5cd8-9536-4989-88b0-89c41aa45998",
"PAYDATETIME": "2024-07-02T16:25:43.269+02:00",
"PAYTIMESTAMP": "1719930343269",
"PAID": 1963.01
}
I then executed the below CTAS, to simplify the data/testing I’ve added the where clause
CREATE TABLE avro_sales_per_terminal_point WITH (KAFKA_TOPIC='avro_sales_per_terminal_point',
FORMAT='AVRO',
PARTITIONS=1)
as
SELECT
store->id as store_id,
TerminalPoint as terminal_point,
count(1) as sales_per_terminal
FROM pb_salescompleted
WINDOW TUMBLING (SIZE 1 MINUTE)
WHERE store->Id = '324213441'
group by store->id , TerminalPoint
EMIT CHANGES;
Expecting to get each storeid/terminalpoint to only appear once per minute with a total count for that minute (window). (with the where added expect to only have one record per minute per terminalpoint)
I’m getting the store_id/terminapoint appearing more than once per minute.
I would expect a record to be added to the table at the end of the window periods…
what i seem to be seeing is a new record on every increment per terminalpoint
where is the gap in my understanding…
G