confluentinc / ksql

The database purpose-built for stream processing applications.
https://ksqldb.io
Other
102 stars 1.04k forks source link

ksql-test-runner failing #10035

Open NikNikM opened 1 year ago

NikNikM commented 1 year ago

Describe the bug After testing a session window, the tests are failing because the key seems different. I see that something is added to the original key: FMG pair down *lss150�Y@1200000/1500000 so �Y@1200000/1500000 is not something that I would expect but only FMG pair down *lss150 >>>>> Test failed: Topic 'ksqldb-aggregation-alerts', message 0: Expected <"FMG pair down *lss150", {"count":2,"window_start":"1970-01-01T00:20:00Z","window_end":"1970-01-01T00:24:59Z"}> with timestamp=1499993 and headers=[] but was <[FMG pair down *lss150�Y@1200000/1500000], {count=2, window_start=1970-01-01T00:20:00Z, window_end=1970-01-01T00:24:59Z}> with timestamp=1499993 and headers=[]

Similar case https://github.com/confluentinc/ksql/issues/10008

To Reproduce Steps to reproduce the behavior, include:

  1. The version of KSQL. ksqldb-cli latest [0.28.2]
  2. Sample source data.
  3. Any SQL statements you ran
    SELECT 
    CONCAT(
    'FMG pair down *',
    CASE
    WHEN (LEN(`host_name`) = 15) THEN SUBSTRING(`host_name`, 9)
    WHEN (LEN(`host_name`) = 18) THEN SUBSTRING(`host_name`, 6, 6)
    ELSE 'NULL'
    END) `alert_type`,
    COUNT_DISTINCT(`host_name`) as `count`,
    FORMAT_TIMESTAMP(FROM_UNIXTIME(`WINDOWSTART`),'yyyy-MM-dd''T''HH:mm:ssX') AS `window_start`,
    FORMAT_TIMESTAMP(FROM_UNIXTIME(`WINDOWEND`),'yyyy-MM-dd''T''HH:mm:ssX') AS `window_end`
    FROM EVENTS
    WINDOW SESSION (5 MINUTES)
    WHERE `trigger_name` LIKE '%something%'
    GROUP BY
    CONCAT(
    'FMG pair down *',
    CASE
    WHEN (LEN(`host_name`) = 15) THEN SUBSTRING(`host_name`, 9)
    WHEN (LEN(`host_name`) = 18) THEN SUBSTRING(`host_name`, 6, 6)
    ELSE 'NULL'
    END) 
    HAVING COUNT_DISTINCT(`host_name`) > 1
    EMIT CHANGES;

From my manual test, the query runs and works correctly.

NikNikM commented 1 year ago

It looks like that the problem is not the key itself but in my case it was a wrong output: "window": {"start": 1200000, "end": 1500000, "type": "time"}, which is not shown in the test failed message