confluentinc / ksql

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

KSQL Test Runner doesn't recognize schemas in CREATE STREAM Statement #9057

Open pbettler-CBeds opened 2 years ago

pbettler-CBeds commented 2 years ago

Description KSQL Test Runner fails on testing Create Stream statement that doesn't use SELECT.

To Reproduce KSQL Version: 0.23.1 KSQL Test Runner locally

SQL That produced the error:

CREATE STREAM IF NOT EXISTS SOME_STREAM
  WITH (KAFKA_TOPIC = 'SOME_TOPIC', VALUE_FORMAT = 'AVRO');

Expected behavior Actually running the ksql produces the desired messages. Expecting Test Runner to note the schema from the input data provided, then continue to run the test accordingly.

Actual behaviour Error is produced like so:


Error parsing statement (which may be expected): CREATE STREAM IF NOT EXISTS SOME_STREAM
  WITH (KAFKA_TOPIC = 'SOME_TOPIC', VALUE_FORMAT = 'AVRO');
io.confluent.ksql.util.KsqlException: No columns supplied.
    at io.confluent.ksql.parser.tree.TableElements.toLogicalSchema(TableElements.java:82)
    at io.confluent.ksql.test.tools.TestCaseBuilderUtil.lambda$createTopicFromStatement$6(TestCaseBuilderUtil.java:177)
    at io.confluent.ksql.test.tools.TestCaseBuilderUtil.createTopicFromStatement(TestCaseBuilderUtil.java:230)
    at io.confluent.ksql.test.tools.TestCaseBuilderUtil.getAllTopics(TestCaseBuilderUtil.java:126)
    at io.confluent.ksql.test.tools.TestExecutorUtil.initializeTopics(TestExecutorUtil.java:265)
    at io.confluent.ksql.test.tools.TestExecutorUtil.planTestCase(TestExecutorUtil.java:156)
    at io.confluent.ksql.test.tools.TestExecutorUtil.execute(TestExecutorUtil.java:317)
    at io.confluent.ksql.test.tools.TestExecutorUtil.doBuildQueries(TestExecutorUtil.java:232)
    at io.confluent.ksql.test.tools.TestExecutorUtil.buildStreamsTopologyTestDrivers(TestExecutorUtil.java:104)
    at io.confluent.ksql.test.tools.TestExecutor.buildAndExecuteQuery(TestExecutor.java:165)
    at io.confluent.ksql.test.tools.KsqlTestingTool.executeTestCase(KsqlTestingTool.java:141)
    at io.confluent.ksql.test.tools.KsqlTestingTool.runWithTripleFiles(KsqlTestingTool.java:131)
    at io.confluent.ksql.test.tools.KsqlTestingTool.main(KsqlTestingTool.java:56)

Additional context This may be more suited as an enhancement. Inferring schemas from the input given..? Looking for input

mgvinuesa commented 1 year ago

Same problem here!

Maybe it could be greate if we could provide a directory with the .asvc files with a new parameter (as the extension parameter) and provide the json definition where we can relate the topics with asvc file.

Thanks in advance.