“@type”:“statement_error”,
“error_code”:40001,
“message”:“Cannot cast io.confluent.ksql.parser.tree.StructAll to io.confluent.ksql.parser.tree.SingleColumn”
I got the above error when trying to run a pull query that involves exploding a struct. The same command when run as a push query instead has no issue. I look at the ksqldb docs but it makes no mention that the ->* is valid for push queries only.
I’m trying a basic repro below and both push and pull are working. Could you provide your repro? Also try the repro below and make sure it works for you.
Given this setup:
CREATE STREAM s (
k VARCHAR KEY,
my_struct STRUCT<
inner_string VARCHAR,
inner_int INT
>
) WITH (
kafka_topic = 's-topic',
partitions = 1,
value_format = 'JSON'
);
INSERT INTO s (
k, my_struct
) VALUES (
'the_key', STRUCT(inner_string := 'foo', inner_int := 123)
);
Thank you for the swift reply. I tried your repro and it works for both push and pull query. So it seems it works for Stream. However, when I tried the same but for Table instead of Stream, this is when I got the error.
The steps to reproduce the error is as follows, and I am running Confluent 7.5.2:
CREATE TABLE STRUCT_TEST_TABLE (
k VARCHAR PRIMARY KEY,
simple_struct SRUCT<
inner_string VARCHAR,
inner_int INT
>
) with (
kafka_topic='STRUCT_TEST_TABLE_TOPIC',
PARTITIONS=1,
VALUE_FORMAT='AVRO'
);
INSERT INTO STRUCT_TEST_TABLE (
k, simple_struct
) VALUES (
'the_key', STRUCT(inner_string := 'foo', inner_int := 123)
);