mmolimar / ksql-jdbc-driver

JDBC driver for Apache Kafka
Apache License 2.0
87 stars 19 forks source link

Error parsing query: mismatched input 'PRIMARY' expecting {',', ')' #30

Open Hubbitus opened 4 years ago

Hubbitus commented 4 years ago

I've continue try (https://github.com/mmolimar/ksql-jdbc-driver/issues/29) using that driver and on query:

CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic='datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');

got error: SQL Error: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}

Stacktrace:

org.jkiss.dbeaver.model.sql.DBSQLException: SQL Error: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');..
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:133)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeStatement(SQLQueryJob.java:509)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.lambda$0(SQLQueryJob.java:440)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.executeSingleQuery(SQLQueryJob.java:427)
    at org.jkiss.dbeaver.ui.editors.sql.execute.SQLQueryJob.extractData(SQLQueryJob.java:812)
    at org.jkiss.dbeaver.ui.editors.sql.SQLEditor$QueryResultsContainer.readData(SQLEditor.java:3096)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.lambda$0(ResultSetJobDataRead.java:121)
    at org.jkiss.dbeaver.model.exec.DBExecUtils.tryExecuteRecover(DBExecUtils.java:168)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetJobDataRead.run(ResultSetJobDataRead.java:119)
    at org.jkiss.dbeaver.ui.controls.resultset.ResultSetViewer$ResultSetDataPumpJob.run(ResultSetViewer.java:4460)
    at org.jkiss.dbeaver.model.runtime.AbstractJob.run(AbstractJob.java:105)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.sql.SQLException: Error parsing query 'CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');': line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');..
    at com.github.mmolimar.ksql.jdbc.Exceptions$.wrapException(Exceptions.scala:84)
    at com.github.mmolimar.ksql.jdbc.KsqlStatement.executeKsqlRequest(KsqlStatement.scala:149)
    at com.github.mmolimar.ksql.jdbc.KsqlStatement.execute(KsqlStatement.scala:187)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.execute(JDBCStatementImpl.java:327)
    at org.jkiss.dbeaver.model.impl.jdbc.exec.JDBCStatementImpl.executeStatement(JDBCStatementImpl.java:130)
    ... 12 more
Caused by: io.confluent.ksql.parser.exception.ParseFailedException: line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
Statement: CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');
    at io.confluent.ksql.parser.DefaultKsqlParser.parse(DefaultKsqlParser.java:64)
    at com.github.mmolimar.ksql.jdbc.KsqlStatement.$anonfun$executeKsqlRequest$1(KsqlStatement.scala:148)
    at scala.util.Try$.apply(Try.scala:213)
    at com.github.mmolimar.ksql.jdbc.KsqlStatement.executeKsqlRequest(KsqlStatement.scala:148)
    ... 15 more
Caused by: io.confluent.ksql.parser.ParsingException: line 1:41: mismatched input 'PRIMARY' expecting {',', ')'}
    at io.confluent.ksql.parser.DefaultKsqlParser$1.syntaxError(DefaultKsqlParser.java:50)
    at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41)
    at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportInputMismatch(DefaultErrorStrategy.java:299)
    at org.antlr.v4.runtime.DefaultErrorStrategy.reportError(DefaultErrorStrategy.java:124)
    at io.confluent.ksql.parser.SqlBaseParser.tableElements(SqlBaseParser.java:2117)
    at io.confluent.ksql.parser.SqlBaseParser.statement(SqlBaseParser.java:1541)
    at io.confluent.ksql.parser.SqlBaseParser.singleStatement(SqlBaseParser.java:260)
    at io.confluent.ksql.parser.SqlBaseParser.statements(SqlBaseParser.java:208)
    at io.confluent.ksql.parser.DefaultKsqlParser.getParseTree(DefaultKsqlParser.java:108)
    at io.confluent.ksql.parser.DefaultKsqlParser.parse(DefaultKsqlParser.java:57)
    ... 18 more
Caused by: org.antlr.v4.runtime.InputMismatchException
    at org.antlr.v4.runtime.DefaultErrorStrategy.sync(DefaultErrorStrategy.java:242)
    at io.confluent.ksql.parser.SqlBaseParser.tableElements(SqlBaseParser.java:2096)
    ... 23 more

On ksqlDB cli it works pretty well:

ksql> CREATE TABLE proposals_table (id STRING PRIMARY KEY) WITH (kafka_topic = 'datahub.epm_staf.qa20.v1.m_proposals', value_format='AVRO');

 Message       
---------------
 Table created 
---------------
mmolimar commented 3 years ago

I guess your KSQL version is not the same like the version which is linked to the driver.

Hubbitus commented 3 years ago

How I could check it?

mmolimar commented 3 years ago

If you don't know your KSQL server version, you can use the health check endpoint to query it.

Hubbitus commented 3 years ago

And what version is linked to your released driver?

mmolimar commented 3 years ago

You can see that here.

Hubbitus commented 1 month ago

Do you plan to update it to match 7.7.1 kSQL?

Now I have 7.5.3 really, but would like to update.