You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/03/13 12:45:41 UTC
[jira] [Commented] (CASSANDRA-13246) Querying by secondary index on
collection column returns NullPointerException sometimes
[ https://issues.apache.org/jira/browse/CASSANDRA-13246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15907385#comment-15907385 ]
ASF GitHub Bot commented on CASSANDRA-13246:
--------------------------------------------
Github user MikkelTAndersen commented on the issue:
https://github.com/apache/cassandra/pull/98
Ahh sorry - it seems to complicated, its a simple null check - any chance
you can add it Alex ? I have attached the patch.
On Mon, Mar 13, 2017 at 1:38 PM, Alex Petrov <no...@github.com>
wrote:
> Hi @MikkelTAndersen <https://github.com/MikkelTAndersen>. Cassandra does
> not use pull requests for Apache Cassandra. Please use JIRA directly.
>
> You can get more information on the contribution process here
> https://wiki.apache.org/cassandra/HowToContribute
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/apache/cassandra/pull/98#issuecomment-286095410>, or mute
> the thread
> <https://github.com/notifications/unsubscribe-auth/AACsNo9UVdqa6Ygr4N2jwfUj-0ithzS7ks5rlTi8gaJpZM4MbArn>
> .
>
--
Venlig Hilsen
Mikkel T. Andersen
Skjoldborgvej 8
7100 Vejle
Mobil: +45 40 26 79 26
From dac39d0268ba82b6be033e0c63ebd653ae0517cc Mon Sep 17 00:00:00 2001
From: Mikkel Andersen <mi...@gmail.com>
Date: Mon, 13 Mar 2017 10:21:27 +0100
Subject: [PATCH] added null check - see CASSANDRA-13246
---
.../org/apache/cassandra/db/filter/RowFilter.java | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/java/org/apache/cassandra/db/filter/RowFilter.java b/src/java/org/apache/cassandra/db/filter/RowFilter.java
index bf65e96..c26c1ad 100644
--- a/src/java/org/apache/cassandra/db/filter/RowFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/RowFilter.java
@@ -611,17 +611,19 @@ public abstract class RowFilter implements Iterable<RowFilter.Expression>
if (column.isComplex())
{
ComplexColumnData complexData = row.getComplexColumnData(column);
- for (Cell cell : complexData)
- {
- if (type.kind == CollectionType.Kind.SET)
- {
- if (type.nameComparator().compare(cell.path().get(0), value) == 0)
- return true;
- }
- else
+ if (complexData != null) {
+ for (Cell cell : complexData)
{
- if (type.valueComparator().compare(cell.value(), value) == 0)
- return true;
+ if (type.kind == CollectionType.Kind.SET)
+ {
+ if (type.nameComparator().compare(cell.path().get(0), value) == 0)
+ return true;
+ }
+ else
+ {
+ if (type.valueComparator().compare(cell.value(), value) == 0)
+ return true;
+ }
}
}
return false;
--
2.0.1
From 145087e3b5d748ce25e8792f91c249d2a05de3e5 Mon Sep 17 00:00:00 2001
From: Mikkel Andersen <mi...@gmail.com>
Date: Mon, 13 Mar 2017 10:22:53 +0100
Subject: [PATCH] fixed formatting
---
src/java/org/apache/cassandra/db/filter/RowFilter.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/java/org/apache/cassandra/db/filter/RowFilter.java b/src/java/org/apache/cassandra/db/filter/RowFilter.java
index c26c1ad..d3fc301 100644
--- a/src/java/org/apache/cassandra/db/filter/RowFilter.java
+++ b/src/java/org/apache/cassandra/db/filter/RowFilter.java
@@ -611,7 +611,8 @@ public abstract class RowFilter implements Iterable<RowFilter.Expression>
if (column.isComplex())
{
ComplexColumnData complexData = row.getComplexColumnData(column);
- if (complexData != null) {
+ if (complexData != null)
+ {
for (Cell cell : complexData)
{
if (type.kind == CollectionType.Kind.SET)
--
2.0.1
> Querying by secondary index on collection column returns NullPointerException sometimes
> ---------------------------------------------------------------------------------------
>
> Key: CASSANDRA-13246
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13246
> Project: Cassandra
> Issue Type: Bug
> Environment: [cqlsh 5.0.1 | Cassandra 3.7 | CQL spec 3.4.2 | Native protocol v4]
> One cassandra node up, with consistency ONE
> Reporter: hochung
> Assignee: Andrés de la Peña
>
> Not sure if this is the absolute minimal case that produces the bug, but here are the steps for reproducing.
> 1. Create table
> {code}
> CREATE TABLE test (
> id text,
> ck1 text,
> ck2 text,
> static_value text static,
> set_value set<text>,
> primary key (id, ck1, ck2)
> );
> {code}
> 2. Create secondary indices on the clustering columns, static column, and collection column
> {code}
> create index on test (set_value);
> create index on test (static_value);
> create index on test (ck1);
> create index on test (ck2);
> {code}
> 3. Insert a null value into the `set_value` column
> {code}
> insert into test (id, ck1, ck2, static_value, set_value) values ('id', 'key1', 'key2', 'static', {'one', 'two'} );
> {code}
> Sanity check:
> {code}
> select * from test;
> id | ck1 | ck2 | static_value | set_value
> ----+------+------+--------------+----------------
> id | key1 | key2 | static | {'one', 'two'}
> {code}
> 4. Set the set_value to be empty
> {code}
> update test set set_value = {} where id = 'id' and ck1 = 'key1' and ck2 = 'key2';
> {code}
> 5. Make a select query that uses `CONTAINS` in the `set_value` column
> {code}
> select * from test where ck2 = 'key2' and static_value = 'static' and set_value contains 'one' allow filtering;
> {code}
> Here we get a ReadFailure:
> {code}
> ReadFailure: Error from server: code=1300 [Replica(s) failed to execute read] message="Operation failed - received 0 responses and 1 failures" info={'failures': 1, 'received_responses': 0, 'required_responses': 1, 'consistency': 'ONE'}
> {code}
> Logs show a NullPointerException
> {code}
> java.lang.RuntimeException: java.lang.NullPointerException
> at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2470) ~[apache-cassandra-3.7.jar:3.7]
> at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_101]
> at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:164) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$LocalSessionFutureTask.run(AbstractLocalAwareExecutorService.java:136) [apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [apache-cassandra-3.7.jar:3.7]
> at java.lang.Thread.run(Thread.java:745) [na:1.8.0_101]
> Caused by: java.lang.NullPointerException: null
> at org.apache.cassandra.db.filter.RowFilter$SimpleExpression.isSatisfiedBy(RowFilter.java:720) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.filter.RowFilter$CQLFilter$1IsSatisfiedFilter.applyToRow(RowFilter.java:303) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.transform.BaseRows.hasNext(BaseRows.java:120) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.filter.RowFilter$CQLFilter$1IsSatisfiedFilter.applyToPartition(RowFilter.java:293) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.filter.RowFilter$CQLFilter$1IsSatisfiedFilter.applyToPartition(RowFilter.java:281) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.transform.BasePartitions.hasNext(BasePartitions.java:76) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.partitions.UnfilteredPartitionIterators$Serializer.serialize(UnfilteredPartitionIterators.java:289) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.ReadResponse$LocalDataResponse.build(ReadResponse.java:134) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.ReadResponse$LocalDataResponse.<init>(ReadResponse.java:127) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.ReadResponse$LocalDataResponse.<init>(ReadResponse.java:123) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.ReadResponse.createDataResponse(ReadResponse.java:65) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.db.ReadCommand.createResponse(ReadCommand.java:292) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.service.StorageProxy$LocalReadRunnable.runMayThrow(StorageProxy.java:1799) ~[apache-cassandra-3.7.jar:3.7]
> at org.apache.cassandra.service.StorageProxy$DroppableRunnable.run(StorageProxy.java:2466) ~[apache-cassandra-3.7.jar:3.7]
> ... 5 common frames omitted
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)