Manuel Kießling created CASSANDRA-14989: -------------------------------------------
Summary: NullPointerException when SELECTing token() on only one part of a two-part partition key Key: CASSANDRA-14989 URL: https://issues.apache.org/jira/browse/CASSANDRA-14989 Project: Cassandra Issue Type: Bug Components: CQL/Interpreter Environment: Using {{cqlsh 5.0.1}} on a Mac OS X host system with Cassandra 3.11.3 running via Docker for Mac from the official {{cassandra:3.11.3}} image. Reporter: Manuel Kießling I have the following schema: {code} CREATE TABLE query_tests.cart_snapshots ( cart_id uuid, realm text, snapshot_id timeuuid, state text, PRIMARY KEY ((cart_id, realm), snapshot_id) ) WITH CLUSTERING ORDER BY (snapshot_id DESC) AND bloom_filter_fp_chance = 0.01 AND caching = {'keys': 'ALL', 'rows_per_partition': 'NONE'} AND comment = '' AND compaction = {'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'} AND compression = {'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'} AND crc_check_chance = 1.0 AND dclocal_read_repair_chance = 0.1 AND default_time_to_live = 0 AND gc_grace_seconds = 864000 AND max_index_interval = 2048 AND memtable_flush_period_in_ms = 0 AND min_index_interval = 128 AND read_repair_chance = 0.0 AND speculative_retry = '99PERCENTILE'; {code} In cqlsh, I try the following query: {code}select token(cart_id) from cart_snapshots ;{code} This results in cqlsh returning {{ServerError: java.lang.NullPointerException}}, and the following error in the server log: {code} DC1N1_1 | ERROR [Native-Transport-Requests-1] 2019-01-16 12:17:52,075 QueryMessage.java:129 - Unexpected error during query DC1N1_1 | java.lang.NullPointerException: null DC1N1_1 | at org.apache.cassandra.db.marshal.CompositeType.build(CompositeType.java:356) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.db.marshal.CompositeType.build(CompositeType.java:349) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.config.CFMetaData.serializePartitionKey(CFMetaData.java:805) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.functions.TokenFct.execute(TokenFct.java:59) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.ScalarFunctionSelector.getOutput(ScalarFunctionSelector.java:61) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$SelectionWithProcessing$1.getOutputRow(Selection.java:666) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.getOutputRow(Selection.java:492) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.newRow(Selection.java:458) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.processPartition(SelectStatement.java:860) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:790) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:438) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:416) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:289) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:117) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:224) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:255) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:240) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:517) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:35) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:348) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_181] DC1N1_1 | at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181] DC1N1_1 | ERROR [Native-Transport-Requests-1] 2019-01-16 12:17:52,076 ErrorMessage.java:384 - Unexpected exception during request DC1N1_1 | java.lang.NullPointerException: null DC1N1_1 | at org.apache.cassandra.db.marshal.CompositeType.build(CompositeType.java:356) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.db.marshal.CompositeType.build(CompositeType.java:349) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.config.CFMetaData.serializePartitionKey(CFMetaData.java:805) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.functions.TokenFct.execute(TokenFct.java:59) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.ScalarFunctionSelector.getOutput(ScalarFunctionSelector.java:61) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$SelectionWithProcessing$1.getOutputRow(Selection.java:666) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.getOutputRow(Selection.java:492) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.selection.Selection$ResultSetBuilder.newRow(Selection.java:458) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.processPartition(SelectStatement.java:860) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:790) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:438) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:416) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:289) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:117) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:224) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:255) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:240) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:116) ~[apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:517) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:410) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:105) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:357) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext.access$600(AbstractChannelHandlerContext.java:35) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at io.netty.channel.AbstractChannelHandlerContext$7.run(AbstractChannelHandlerContext.java:348) [netty-all-4.0.44.Final.jar:4.0.44.Final] DC1N1_1 | at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [na:1.8.0_181] DC1N1_1 | at org.apache.cassandra.concurrent.AbstractLocalAwareExecutorService$FutureTask.run(AbstractLocalAwareExecutorService.java:162) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:109) [apache-cassandra-3.11.3.jar:3.11.3] DC1N1_1 | at java.lang.Thread.run(Thread.java:748) [na:1.8.0_181] {code} -- 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