[ 
https://issues.apache.org/jira/browse/CASSANDRA-12012?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mahdi Mohammadi reassigned CASSANDRA-12012:
-------------------------------------------

    Assignee: Mahdi Mohammadi

> CQLSSTableWriter and composite clustering keys trigger NPE
> ----------------------------------------------------------
>
>                 Key: CASSANDRA-12012
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-12012
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Streaming and Messaging
>            Reporter: Pierre N.
>            Assignee: Mahdi Mohammadi
>
> It triggers when using multiple clustering keys in the primary keys
> {code}
> package tests;
> import java.io.File;
> import org.apache.cassandra.io.sstable.CQLSSTableWriter;
> import org.apache.cassandra.config.Config;
> public class DefaultWriter {
>     
>     public static void main(String[] args) throws Exception {
>         Config.setClientMode(true);
>         
>         String createTableQuery = "CREATE TABLE ks_test.table_test ("
>         + "    pk1 int,"
>         + "    ck1 int,"
>         + "    ck2 int,"
>         + "    PRIMARY KEY ((pk1), ck1, ck2)"
>         + ");";
>         String insertQuery = "INSERT INTO ks_test.table_test(pk1, ck1, ck2) 
> VALUES(?,?,?)";
>         
>         CQLSSTableWriter writer = CQLSSTableWriter.builder()
>             .inDirectory(File.createTempFile("sstdir", "-tmp"))
>             .forTable(createTableQuery)
>             .using(insertQuery)
>             .build();
>         writer.close();
>     }
> }
> {code}
> Exception : 
> {code}
> Exception in thread "main" java.lang.ExceptionInInitializerError
>       at org.apache.cassandra.db.Keyspace.initCf(Keyspace.java:368)
>       at org.apache.cassandra.db.Keyspace.<init>(Keyspace.java:305)
>       at org.apache.cassandra.db.Keyspace.open(Keyspace.java:129)
>       at org.apache.cassandra.db.Keyspace.open(Keyspace.java:106)
>       at org.apache.cassandra.db.Keyspace.openAndGetStore(Keyspace.java:159)
>       at 
> org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictionSet.hasSupportingIndex(PrimaryKeyRestrictionSet.java:156)
>       at 
> org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictionSet.<init>(PrimaryKeyRestrictionSet.java:118)
>       at 
> org.apache.cassandra.cql3.restrictions.PrimaryKeyRestrictionSet.mergeWith(PrimaryKeyRestrictionSet.java:213)
>       at 
> org.apache.cassandra.cql3.restrictions.StatementRestrictions.addSingleColumnRestriction(StatementRestrictions.java:266)
>       at 
> org.apache.cassandra.cql3.restrictions.StatementRestrictions.addRestriction(StatementRestrictions.java:250)
>       at 
> org.apache.cassandra.cql3.restrictions.StatementRestrictions.<init>(StatementRestrictions.java:159)
>       at 
> org.apache.cassandra.cql3.statements.UpdateStatement$ParsedInsert.prepareInternal(UpdateStatement.java:183)
>       at 
> org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.prepare(ModificationStatement.java:782)
>       at 
> org.apache.cassandra.cql3.statements.ModificationStatement$Parsed.prepare(ModificationStatement.java:768)
>       at 
> org.apache.cassandra.cql3.QueryProcessor.getStatement(QueryProcessor.java:505)
>       at 
> org.apache.cassandra.io.sstable.CQLSSTableWriter$Builder.getStatement(CQLSSTableWriter.java:508)
>       at 
> org.apache.cassandra.io.sstable.CQLSSTableWriter$Builder.using(CQLSSTableWriter.java:439)
>       at tests.DefaultWriter.main(DefaultWriter.java:29)
> Caused by: java.lang.NullPointerException
>       at 
> org.apache.cassandra.config.DatabaseDescriptor.getFlushWriters(DatabaseDescriptor.java:1188)
>       at 
> org.apache.cassandra.db.ColumnFamilyStore.<clinit>(ColumnFamilyStore.java:127)
>       ... 18 more
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to