KSQL Explode array of struct

Hi,
I have my source data in this format:

{
"FIELD_1": "ABCD",
"FIELD_2": {
    "FIELD_3": "ABCD",
    "FIELD_4":  [
					{
						"FIELD_5": "0000000000001",
						"FIELD_6": "01"
					},
					{
						"FIELD_5": "0000000000002",
						"FIELD_6": "02"
					}
				]
			}
}

I created a table with this DDL:

create table TABLE_1
(
FIELD_1 varchar, 
Object_spcId varchar, 
FIELD_2 STRUCT<FIELD_3 varchar, FIELD_4 Array<Struct<FIELD_5 varchar, FIELD_6 varchar>>>
) WITH (KAFKA_TOPIC = 'topic',
        VALUE_FORMAT='JSON');

How I can explode my array in order to have one row for each elemento of the array?
I tryed to use the EXPLODE function but I have no resulto. The string “source” is returned after executing the query without any error:

select FIELD_1, FIELD_2->FIELD_3, EXPLODE(FIELD_2->FIELD_4) from TABLE_1 where emit changes;

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