cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sylvain Lebresne (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CASSANDRA-10363) NullPointerException returned with select ttl(value), IN, ORDER BY and paging off
Date Thu, 17 Sep 2015 14:48:04 GMT

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

Sylvain Lebresne updated CASSANDRA-10363:
-----------------------------------------
    Assignee: Benjamin Lerer

> NullPointerException returned with select ttl(value), IN, ORDER BY and paging off
> ---------------------------------------------------------------------------------
>
>                 Key: CASSANDRA-10363
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-10363
>             Project: Cassandra
>          Issue Type: Bug
>         Environment: Apache Cassandra 2.1.8.689
>            Reporter: Sucwinder Bassi
>            Assignee: Benjamin Lerer
>            Priority: Minor
>
> Running this query with paging off returns a NullPointerException:
> cqlsh:test> SELECT value, ttl(value), last_modified FROM test where useruid='userid1'
AND direction IN ('out','in') ORDER BY last_modified; 
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.NullPointerException">
> Here's the stack trace from the system.log:
> ERROR [SharedPool-Worker-1] 2015-09-17 13:11:03,937  ErrorMessage.java:251 - Unexpected
exception during request
> java.lang.NullPointerException: null
>         at org.apache.cassandra.db.marshal.LongType.compareLongs(LongType.java:41) ~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.db.marshal.TimestampType.compare(TimestampType.java:48)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.db.marshal.TimestampType.compare(TimestampType.java:38)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement$SingleColumnComparator.compare(SelectStatement.java:2419)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement$SingleColumnComparator.compare(SelectStatement.java:2406)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at java.util.TimSort.countRunAndMakeAscending(TimSort.java:351) ~[na:1.8.0_40]
>         at java.util.TimSort.sort(TimSort.java:216) ~[na:1.8.0_40]
>         at java.util.Arrays.sort(Arrays.java:1512) ~[na:1.8.0_40]
>         at java.util.ArrayList.sort(ArrayList.java:1454) ~[na:1.8.0_40]
>         at java.util.Collections.sort(Collections.java:175) ~[na:1.8.0_40]
>         at org.apache.cassandra.cql3.statements.SelectStatement.orderResults(SelectStatement.java:1400)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:1255)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:299)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:276)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:224)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:67)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:238)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at com.datastax.bdp.cassandra.cql3.DseQueryHandler$StatementExecution.execute(DseQueryHandler.java:291)
~[dse.jar:4.7.3]
>         at com.datastax.bdp.cassandra.cql3.DseQueryHandler$Operation.executeWithTiming(DseQueryHandler.java:223)
~[dse.jar:4.7.3]
>         at com.datastax.bdp.cassandra.cql3.DseQueryHandler$Operation.executeWithAuditLogging(DseQueryHandler.java:259)
~[dse.jar:4.7.3]
>         at com.datastax.bdp.cassandra.cql3.DseQueryHandler.process(DseQueryHandler.java:94)
~[dse.jar:4.7.3]
>         at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:122)
~[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:439)
[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:335)
[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
>         at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:333)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
>         at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:32)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
>         at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:324)
[netty-all-4.0.23.Final.jar:4.0.23.Final]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_40]
>         at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:164)
[cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:105) [cassandra-all-2.1.8.689.jar:2.1.8.689]
>         at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40]
> Here's the full reproduction:
> CREATE KEYSPACE TEST 
> WITH replication = {'class': 'SimpleStrategy', 'replication_factor':3} 
> AND durable_writes = true;
> USE test;
> CREATE TABLE test ( 
> useruid varchar, 
> direction varchar, 
> last_modified timestamp, 
> value varchar, 
> PRIMARY KEY ((useruid, direction), last_modified) 
> );
> //insert 4 entries in the table 
> INSERT INTO test (useruid,direction,last_modified,value) VALUES ('userid1', 'out', '2013-05-13
15:18:51', 'a value1'); 
> INSERT INTO test (useruid,direction,last_modified,value) VALUES ('userid1', 'out', '2013-05-13
15:12:51', 'a value2'); 
> INSERT INTO test (useruid,direction,last_modified,value) VALUES ('userid1', 'none', '2013-05-13
15:20:51', 'a value3'); 
> INSERT INTO test (useruid,direction,last_modified,value) VALUES ('userid1', 'in', '2013-05-13
15:34:51', 'a value4');
> First query to check the value in the table, and its results : 
> SELECT value, ttl(value), last_modified FROM test; 
> value | ttl(value) | last_modified
> ----------+------------+--------------------------
> a value4 | null | 2013-05-13 15:34:51+0000
> a value2 | null | 2013-05-13 15:12:51+0000
> a value1 | null | 2013-05-13 15:18:51+0000
> a value3 | null | 2013-05-13 15:20:51+0000
> (4 rows)
> Run this query using the IN clause and the ORDER BY clause, but it fails with an error:
> SELECT value, ttl(value), last_modified FROM test where useruid='userid1' AND direction
IN ('out','in') ORDER BY last_modified; 
> InvalidRequest: code=2200 [Invalid query] message="Cannot page queries with both ORDER
BY and a IN restriction on the partition key; you must either remove the ORDER BY or the IN
and sort client side, or disable paging for this query"
> If you run the same query without the ttl(value) in the SELECT part, it also shows the
same error:
>  
> SELECT value, last_modified FROM test where useruid='userid1' AND direction IN ('out','in')
ORDER BY last_modified; 
> InvalidRequest: code=2200 [Invalid query] message="Cannot page queries with both ORDER
BY and a IN restriction on the partition key; you must either remove the ORDER BY or the IN
and sort client side, or disable paging for this query"
> This message suggests these JIRAs are the reason for this message:
> https://issues.apache.org/jira/browse/CASSANDRA-7853 select . . . in . . . order by regression
> Resolution: Duplicate of CASSANDRA-7514
> Fix Version/s: None
> https://issues.apache.org/jira/browse/CASSANDRA-7514 Support paging in cqlsh
> Resolution: Fixed
> Fix Version/s: 2.1.1
> https://issues.apache.org/jira/browse/CASSANDRA-6722 cross-partition ordering should
have warning or be disallowed when paging
> Resolution: Fixed
> Fix Version/s: 2.0.6
> If I turn off paging:
> cqlsh:test> paging off;
> Disabled Query paging.
> Then re-run the query without the ttl(value) I see the results:
> cqlsh:test> SELECT value, last_modified FROM test where useruid='userid1' AND direction
IN ('out','in') ORDER BY last_modified;
> value | last_modified
> ----------+--------------------------
> a value2 | 2013-05-13 15:12:51+0000
> a value1 | 2013-05-13 15:18:51+0000
> a value4 | 2013-05-13 15:34:51+0000
> (3 rows)
> However, if you now re-run this query with the ttl(value) you get a NullPointerException:
> cqlsh:test> SELECT value, ttl(value), last_modified FROM test where useruid='userid1'
AND direction IN ('out','in') ORDER BY last_modified; 
> ServerError: <ErrorMessage code=0000 [Server error] message="java.lang.NullPointerException">



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

Mime
View raw message