Query error with JDBC with cassandra input


(Giuseppe) #1

Hi,
I have a problem with logstash jdbc plugin (I use dbschema.CassandraJdbcDriver) and cassandra. When I start logstash I obtain always this error in logstash logs:

[ERROR][logstash.inputs.jdbc ] Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:32 no viable alternative at input '(' (...() AS "COUNT" FROM [(]...): SELECT count() AS "COUNT" FROM (SELECT * FROM database.products ) AS "T1" LIMIT 1

[2018-01-26T16:54:02,724][WARN ][logstash.inputs.jdbc ] Exception when executing JDBC query {:exception=>#<Sequel::DatabaseError: Java::ComDatastaxDriverCoreExceptions::SyntaxError: line 1:32 no viable alternative at input '(' (...(*) AS "COUNT" FROM [(]...)>}

this is my config input:

  clean_run => "true"
  jdbc_driver_library => "/home/logstash_driver/CassandraDBSchema/cassandrajdbc1.1.jar" 
  jdbc_driver_class => "com.dbschema.CassandraJdbcDriver" 
  statement => "SELECT * FROM database.products " # Your query
  jdbc_paging_enabled => "true"
  jdbc_page_size => "50000"
  schedule => "* * * * *"
  sql_log_level => "info"

While I was testing I noticed that when I active pagination ( jdbc_paging_enabled => "true" )
jdbc plugin adds a query count to my query:

SELECT count(*) AS "COUNT" FROM (SELECT * FROM database.products ) AS "T1" LIMIT 1

and Cassandra doesn't support this subquery.

I thought about solving with a limit in the query statement: SELECT * FROM database.products LIMIT 10000
and disabled jdbc paging ( jdbc_paging_enabled => "false").

But it doesn't seem a good solution, another solution?
Many thanks


(system) #3

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.