Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVG UDAF doesn't work with DELIMITED format #4294

Closed
big-andy-coates opened this issue Jan 13, 2020 · 2 comments
Closed

AVG UDAF doesn't work with DELIMITED format #4294

big-andy-coates opened this issue Jan 13, 2020 · 2 comments
Labels

Comments

@big-andy-coates
Copy link
Contributor

The DELIMITED format does not support STRUCTs. But the AVG uses a STRUCT in its intermediate format. Hence AVG doesn't work with DELIMITED.

Error message is:

io.confluent.ksql.util.KsqlException: Value format does not support value schema.
format: DELIMITED
schema: Persistence{schema=STRUCT<KSQL_INTERNAL_COL_0 INT, KSQL_INTERNAL_COL_1 VARCHAR, KSQL_AGG_VARIABLE_0 STRUCT<SUM INT, COUNT BIGINT>> NOT NULL, unwrapped=false}
reason: The 'DELIMITED' format does not support type 'STRUCT'

Which is likely to cause users confusion.

We should:

  1. I'm prove the error message in the short term. (KSQL already tests that schemas of C* and C*AS statements are supported by the chosen format - we should the same for internal formats).
  2. Fix this shortcoming by not using DELIMITED as an internal format. There is already a issue that covers this: Design format for internal topics/stores for extensibility #3950
big-andy-coates added a commit to big-andy-coates/ksql that referenced this issue Jan 13, 2020
See confluentinc#4294

`AVG` doesn't work with `DELIMITED` format and the error message isn't great.

Example statements that cause the error:

```sql
-- Given:
CREATE STREAM INPUT (VALUE integer) WITH (kafka_topic='test_topic', value_format='DELIMITED');

-- When:
CREATE TABLE OUTPUT AS SELECT avg(value) AS avg FROM INPUT group by ROWKEY;
```

Old error message:

```
ksql> CREATE TABLE OUTPUT AS SELECT avg(value) AS avg FROM INPUT group by ROWKEY;
CREATE TABLE OUTPUT AS SELECT avg(value)Value format does not support value schema.
format: DELIMITED
schema: Persistence{schema=STRUCT<KSQL_INTERNAL_COL_0 INT, KSQL_INTERNAL_COL_1 VARCHAR, KSQL_AGG_VARIABLE_0 STRUCT<SUM INT, COUNT BIGINT>> NOT NULL, unwrapped=false}
reason: The 'DELIMITED' format does not support type 'STRUCT'
Caused by: The 'DELIMITED' format does not support type 'STRUCT'
```

This PR improves the error message a bit:

New error message:

```
One of the functions used in the statement has an intermediate type that the value format can not handle. Please remove the function or change the format.
Consider up-voting confluentinc#3950, which will resolve this limitation
Caused by: Value format does not support value schema.
format: DELIMITED
schema:
	Persistence{schema=STRUCT<KSQL_INTERNAL_COL_0 INT, KSQL_INTERNAL_COL_1 VARCHAR,
	KSQL_AGG_VARIABLE_0 STRUCT<SUM INT, COUNT BIGINT>> NOT NULL,
	unwrapped=false}
reason: The 'DELIMITED' format does not support type 'STRUCT'
Caused by: The 'DELIMITED' format does not support type 'STRUCT'
```
@big-andy-coates
Copy link
Contributor Author

#4295 improves the error message.

@big-andy-coates
Copy link
Contributor Author

Closing issue as a duplicate of #3950

big-andy-coates added a commit that referenced this issue Jan 13, 2020
See #4294

`AVG` doesn't work with `DELIMITED` format and the error message isn't great.

Example statements that cause the error:

```sql
-- Given:
CREATE STREAM INPUT (VALUE integer) WITH (kafka_topic='test_topic', value_format='DELIMITED');

-- When:
CREATE TABLE OUTPUT AS SELECT avg(value) AS avg FROM INPUT group by ROWKEY;
```

Old error message:

```
ksql> CREATE TABLE OUTPUT AS SELECT avg(value) AS avg FROM INPUT group by ROWKEY;
CREATE TABLE OUTPUT AS SELECT avg(value)Value format does not support value schema.
format: DELIMITED
schema: Persistence{schema=STRUCT<KSQL_INTERNAL_COL_0 INT, KSQL_INTERNAL_COL_1 VARCHAR, KSQL_AGG_VARIABLE_0 STRUCT<SUM INT, COUNT BIGINT>> NOT NULL, unwrapped=false}
reason: The 'DELIMITED' format does not support type 'STRUCT'
Caused by: The 'DELIMITED' format does not support type 'STRUCT'
```

This PR improves the error message a bit:

New error message:

```
One of the functions used in the statement has an intermediate type that the value format can not handle. Please remove the function or change the format.
Consider up-voting #3950, which will resolve this limitation
Caused by: Value format does not support value schema.
format: DELIMITED
schema:
	Persistence{schema=STRUCT<KSQL_INTERNAL_COL_0 INT, KSQL_INTERNAL_COL_1 VARCHAR,
	KSQL_AGG_VARIABLE_0 STRUCT<SUM INT, COUNT BIGINT>> NOT NULL,
	unwrapped=false}
reason: The 'DELIMITED' format does not support type 'STRUCT'
Caused by: The 'DELIMITED' format does not support type 'STRUCT'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant