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

Michael Shuler updated CASSANDRA-13670:
---------------------------------------
    Fix Version/s:     (was: 3.0.14)
                   3.0.x

> NullPointerException while closing CQLSSTableWriter
> ---------------------------------------------------
>
>                 Key: CASSANDRA-13670
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-13670
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Tools
>         Environment: Linux
>            Reporter: Arpan Khandelwal
>            Priority: Major
>             Fix For: 3.0.x
>
>
> Reading data from csv file and writing using CQLSSTableWriter. 
> {code:java}
>       CQLSSTableWriter.Builder builder = CQLSSTableWriter.builder();
>         
> builder.inDirectory(outputDir).forTable(createDDL).using(insertDML).withPartitioner(new
>  Murmur3Partitioner());
>         CQLSSTableWriter writer = builder.build();
> {code}
> {code:java}
>  try (BufferedReader reader = new BufferedReader(new FileReader(csvFilePath));
>             CsvListReader csvReader = new CsvListReader(reader, 
> CsvPreference.STANDARD_PREFERENCE);) {
>         List<String> line;
>         while ((line = csvReader.read()) != null) {
>             List<ByteBuffer> bbl = new ArrayList<>();
>             for (String l : line) {
>                 bbl.add(ByteBuffer.wrap(l.getBytes()));
>             }
>             writer.rawAddRow(bbl);
>             // If I use writer.addRow(); it works fine.
>         }
>     } finally {
>         writer.close();
>     }
> {code}
> Getting below exception
> {code:java}
> java.lang.RuntimeException: java.lang.NullPointerException
>         at 
> org.apache.cassandra.io.sstable.SSTableSimpleUnsortedWriter.close(SSTableSimpleUnsortedWriter.java:136)
>         at 
> org.apache.cassandra.io.sstable.CQLSSTableWriter.close(CQLSSTableWriter.java:280)
>         at com.cfx.cassandra.SSTableCreator.execute(SSTableCreator.java:155)
>         at com.cfx.cassandra.SSTableCreator.main(SSTableCreator.java:84)
>     Caused by: java.lang.NullPointerException
>         at 
> org.apache.cassandra.io.sstable.format.SSTableReader.saveSummary(SSTableReader.java:910)
>         at 
> org.apache.cassandra.io.sstable.format.big.BigTableWriter$IndexWriter.doPrepare(BigTableWriter.java:472)
>         at 
> org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:173)
>         at 
> org.apache.cassandra.io.sstable.format.big.BigTableWriter$TransactionalProxy.doPrepare(BigTableWriter.java:303)
>         at 
> org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:173)
>         at 
> org.apache.cassandra.io.sstable.format.SSTableWriter.prepareToCommit(SSTableWriter.java:229)
>         at 
> org.apache.cassandra.io.sstable.SimpleSSTableMultiWriter.prepareToCommit(SimpleSSTableMultiWriter.java:97)
>         at 
> org.apache.cassandra.io.sstable.SSTableTxnWriter.doPrepare(SSTableTxnWriter.java:77)
>         at 
> org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.prepareToCommit(Transactional.java:173)
>         at 
> org.apache.cassandra.utils.concurrent.Transactional$AbstractTransactional.finish(Transactional.java:184)
>         at 
> org.apache.cassandra.io.sstable.SSTableTxnWriter.finish(SSTableTxnWriter.java:92)
>         at 
> org.apache.cassandra.io.sstable.SSTableSimpleUnsortedWriter$DiskWriter.run(SSTableSimpleUnsortedWriter.java:210)
> {code}
> If I use writer.addRow(); instead of using writer.rawAddRow() it works fine.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to