ksql icon indicating copy to clipboard operation
ksql copied to clipboard

ksql-test-runner fails to match outputs with structs in it.

Open rahulbats opened this issue 4 years ago • 4 comments

Describe the bug ksql-test-runner fails to match outputs with structs in it.

To Reproduce Steps to reproduce the behavior, include: create a statement which creates struct like this SELECT STRUCT(SOME_COL := 1234, TYPE := 'SOME_TYPE') as Subject FROM INPUT_TOPIC;

Expected behavior our output file has rows like this { "outputs": [ {"topic": "test_topic", "timestamp": 0, "key": 1, "value": {"Subject":{"SOME_COL": 1234, "TYPE": "SOME_TYPE"}}}, ] }

Actual behaviour Test is failing as it is not able to match

rahulbats avatar Aug 23 '21 19:08 rahulbats

Hello @rahulbats - it looks like you've flipped the struct definition. The syntax is STRUCT(col_name := col_value). Pleaes read https://docs.ksqldb.io/en/latest/how-to-guides/query-structured-data/#structs for an example.

Closing out this ticket.

agavra avatar Aug 23 '21 19:08 agavra

Seems like it was a typo, @rahulbats will update the description

agavra avatar Aug 23 '21 20:08 agavra

I have encountered the same situation. Please any update or workaround on testing this Struct-key type?

realfredlai avatar Feb 15 '23 01:02 realfredlai

ksql-test-runner doesn't output the correct format of data when using STRUCTs, however in the cases I've used it does match the expected output and actual output correctly. Debugging is confusing due to the debug output showing SOME_COL := 1234, TYPE := 'SOME_TYPE', rather than the actual format of "SOME_COL": 1234, "TYPE": "SOME_TYPE". Could the debug output be displayed as JSON to reduce confusion?

GeorgeBemrose avatar Oct 22 '24 11:10 GeorgeBemrose