[ 
https://issues.apache.org/jira/browse/CASSANDRA-14200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17108654#comment-17108654
 ] 

Thanh edited comment on CASSANDRA-14200 at 5/15/20, 9:26 PM:
-------------------------------------------------------------

You can workaround the problem by updating the bad "null" value to a "good" 
null value using

update <MY_TABLE> set <MY_TS_FIELD>=null where <PK_FIELD>=<PK_VALUE>;

but you'll still see the NPE until the sstable containing the "bad" null value 
is compacted with the sstable containing the "good" null value (since existing 
sstables are immutable)


was (Author: thatran):
You can workaround the problem by updating the bad "null" value to a "good" 
null value using

update <MY_TABLE> set <MY_TS_FIELD>=null where <PK_FIELD>=<PK_VALUE>;

but you'll still see the NPE until the sstable containing the "bad" null value 
is compacted with the sstable containing the "good" null value.

> NullPointerException when dumping sstable with null value for timestamp column
> ------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-14200
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-14200
>             Project: Cassandra
>          Issue Type: Bug
>          Components: Legacy/Core
>            Reporter: Simon Zhou
>            Assignee: Simon Zhou
>            Priority: Normal
>             Fix For: 3.0.x
>
>
> We have an sstable whose schema has a column of type timestamp and it's not 
> part of primary key. When dumping the sstable using sstabledump there is NPE 
> like this:
> {code:java}
> Exception in thread "main" java.lang.NullPointerException
> at java.util.Calendar.setTime(Calendar.java:1770)
> at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943)
> at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)
> at java.text.DateFormat.format(DateFormat.java:345)
> at 
> org.apache.cassandra.db.marshal.TimestampType.toJSONString(TimestampType.java:93)
> at 
> org.apache.cassandra.tools.JsonTransformer.serializeCell(JsonTransformer.java:442)
> at 
> org.apache.cassandra.tools.JsonTransformer.serializeColumnData(JsonTransformer.java:376)
> at 
> org.apache.cassandra.tools.JsonTransformer.serializeRow(JsonTransformer.java:280)
> at 
> org.apache.cassandra.tools.JsonTransformer.serializePartition(JsonTransformer.java:215)
> at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
> at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
> at java.util.Iterator.forEachRemaining(Iterator.java:116)
> at 
> java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
> at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
> at 
> java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
> at 
> java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
> at 
> java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
> at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
> at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
> at org.apache.cassandra.tools.JsonTransformer.toJson(JsonTransformer.java:104)
> at org.apache.cassandra.tools.SSTableExport.main(SSTableExport.java:242){code}
> The reason is that we use a null Date when there is no value for this column:
> {code}
>     public Date deserialize(ByteBuffer bytes)
>     {
>         return bytes.remaining() == 0 ? null : new 
> Date(ByteBufferUtil.toLong(bytes));
>     }
> {code}
> It seems that we should not deserialize columns with null values.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to