You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Russ Hatch (JIRA)" <ji...@apache.org> on 2014/08/02 00:11:40 UTC

[jira] [Created] (CASSANDRA-7670) selecting field from empty UDT cell using dot notation triggers exception

Russ Hatch created CASSANDRA-7670:
-------------------------------------

             Summary: selecting field from empty UDT cell using dot notation triggers exception
                 Key: CASSANDRA-7670
                 URL: https://issues.apache.org/jira/browse/CASSANDRA-7670
             Project: Cassandra
          Issue Type: Bug
            Reporter: Russ Hatch
            Priority: Minor


Hopefully the title explains the issue.

Basically if a row has a user type which is undefined, using the "dot notation" syntax causes cqlsh to show a NPE, and an exception ends up in the log as well.

I would expect the behavior here to execute the query and return null, since the user type itself is null, then it's fields are null as well (the downside here is there would be no way to distinguish between a null UDT and a null UDT field, without making an initial query to check if the UDT is non-null).

Steps to repro:
{noformat}
create keyspace test with replication = {'class':'SimpleStrategy', 'replication_factor':1};

use test;

CREATE TYPE t_item (subitem text);

create table mytable (value1 text PRIMARY KEY, value2 test, item t_item);

insert into mytable (value1, value2 ) values ('foo', 'bar');

select item.subitem from mytable;
<ErrorMessage code=0000 [Server error] message="java.lang.NullPointerException">
{noformat}
Here's the exception logged:
{noformat}
ERROR [SharedPool-Worker-1] 2014-08-01 15:49:00,514 ErrorMessage.java:218 - Unexpected exception during request
java.lang.NullPointerException: null
        at org.apache.cassandra.db.marshal.TupleType.split(TupleType.java:146) ~[main/:na]
        at org.apache.cassandra.cql3.statements.Selection$FieldSelector.compute(Selection.java:469) ~[main/:na]
        at org.apache.cassandra.cql3.statements.Selection$SelectionWithFunctions.handleRow(Selection.java:537) ~[main/:na]
        at org.apache.cassandra.cql3.statements.Selection$ResultSetBuilder.build(Selection.java:333) ~[main/:na]
        at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:1149) ~[main/:na]
        at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:283) ~[main/:na]
        at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:225) ~[main/:na]
        at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:60) ~[main/:na]
        at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:187) ~[main/:na]
        at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:206) ~[main/:na]
        at org.apache.cassandra.transport.messages.QueryMessage.execute(QueryMessage.java:118) ~[main/:na]
        at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:421) [main/:na]
        at org.apache.cassandra.transport.Message$Dispatcher.channelRead0(Message.java:318) [main/:na]
        at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103) [netty-all-4.0.20.Final.jar:4.0.20.Final]
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:332) [netty-all-4.0.20.Final.jar:4.0.20.Final]
        at io.netty.channel.AbstractChannelHandlerContext.access$700(AbstractChannelHandlerContext.java:31) [netty-all-4.0.20.Final.jar:4.0.20.Final]
        at io.netty.channel.AbstractChannelHandlerContext$8.run(AbstractChannelHandlerContext.java:323) [netty-all-4.0.20.Final.jar:4.0.20.Final]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_65]
        at org.apache.cassandra.concurrent.AbstractTracingAwareExecutorService$FutureTask.run(AbstractTracingAwareExecutorService.java:163) [main/:na]
        at org.apache.cassandra.concurrent.SEPWorker.run(SEPWorker.java:103) [main/:na]
        at java.lang.Thread.run(Thread.java:745) [na:1.7.0_65]
{noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)