spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Wu (JIRA)" <>
Subject [jira] [Created] (SPARK-17614) .jdbc(***) use the sql syntax "where 1=0" that Cassandra does not support
Date Tue, 20 Sep 2016 20:41:20 GMT
Paul Wu created SPARK-17614:

             Summary: .jdbc(***) use the sql syntax "where 1=0" that Cassandra
does not support
                 Key: SPARK-17614
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.0.0
         Environment: Any Spark Runtime 
            Reporter: Paul Wu

I have the code like the following with Cassandra JDBC (

 final String dbTable= "sql_demo";    
        Dataset<Row> jdbcDF
                .jdbc(CASSANDRA_CONNECTION_URL, dbTable, connectionProperties);
        List<Row> rows = jdbcDF.collectAsList();

It threw the error:
Exception in thread "main" java.sql.SQLTransientException: com.datastax.driver.core.exceptions.SyntaxError:
line 1:29 no viable alternative at input '1' (SELECT * FROM sql_demo WHERE [1]...)
	at com.github.adejanovski.cassandra.jdbc.CassandraPreparedStatement.<init>(
	at com.github.adejanovski.cassandra.jdbc.CassandraConnection.prepareStatement(
	at com.github.adejanovski.cassandra.jdbc.CassandraConnection.prepareStatement(
	at com.github.adejanovski.cassandra.jdbc.CassandraConnection.prepareStatement(

The reason is that the Spark jdbc code uses the sql syntax "where 1=0" somewhere (to get the
schema?), but Cassandra does not support this syntax. Not sure how this issue can be resolved...this
is because CQL is not standard sql. 

The following log shows more information:
16/09/20 13:16:35 INFO CassandraConnection  138: Datacenter: %s; Host: %s; Rack: %s

16/09/20 13:16:35 TRACE CassandraPreparedStatement  98: CQL: SELECT * FROM sql_demo WHERE
16/09/20 13:16:35 TRACE RequestHandler  71: [19400322] com.datastax.driver.core.Statement$1@41ccb3b9
16/09/20 13:16:35 TRACE RequestHandler  272: [19400322-1] Starting

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message