Anyway to solve those kind of issue? Like ignore if field is null or not null fields set 0 date while altering table?

Sounds like a bug, I could not find an existing ticket so can you raise a ticket at https://issues.apache.org/jira/browse/CASSANDRA ? 

Please include the version you are using.

 
Thanks
-----------------
Aaron Morton
Cassandra Consultant
New Zealand

@aaronmorton
http://www.thelastpickle.com

On 12/08/2013, at 1:42 PM, Saravanan <suzuki_babu@yahoo.com> wrote:

found the issue. It should not be null when using function on the field.

Anyway to solve those kind of issue? Like ignore if field is null or not null fields set 0 date while altering table?

cqlsh:demodb> select dateof(search_date) from news_comments where search_date=a7790001-02e8-11e3-bc81-fb4a940b08ec and userid=21 allow filtering;

 dateof(search_date)
--------------------------
 2013-08-12 02:46:41+0200

Thanks,
Saravanan


From: Saravanan <suzuki_babu@yahoo.com>
To: "user@cassandra.apache.org" <user@cassandra.apache.org>
Sent: Monday, August 12, 2013 3:13 AM
Subject: cql throw error when secondary timeuuid field use dateof()

Hi,

I am trying to create a comments table. Which has primary key timeuuid and secondary field which also has timeuuid.

when I do query using funtion dateof() it throws error and i needed to reconnect again. But that query don't work at all.

cqlsh:demodb> select id,dateof(search_date) from news_comments;
TSocket read 0 bytes

it works fine if I do the same function for primarykey based timeuuid field

cqlsh:demodb> select id,dateof(created_date),search_date from news_comments;

 id  | dateof(created_date)     | search_date
-----+--------------------------+--------------------------------------
 105 | 2013-08-12 02:46:33+0200 | a2bb29d1-02e8-11e3-bc81-fb4a940b08ec
 105 | 2013-08-12 02:46:36+0200 | a4abd641-02e8-11e3-bc81-fb4a940b08ec
 105 | 2013-08-12 02:46:41+0200 | a7790001-02e8-11e3-bc81-fb4a940b08ec
 105 | 2013-08-12 02:46:44+0200 | a943d4f1-02e8-11e3-bc81-fb4a940b08ec
 100 | 2013-08-07 05:35:47+0200 |                                 null
 100 | 2013-08-07 05:35:58+0200 |                                 null
 100 | 2013-08-07 05:35:59+0200 |                                 null
 100 | 2013-08-07 05:36:00+0200 |                                 null

In systemlog i get following error.

ERROR [Thrift:4] 2013-08-12 03:08:28,303 CustomTThreadPoolServer.java (line 217) Error occurred during processing of message.
java.lang.NullPointerException
    at org.apache.cassandra.utils.UUIDGen.getUUID(UUIDGen.java:76)
    at org.apache.cassandra.cql3.functions.TimeuuidFcts$4.execute(TimeuuidFcts.java:66)
    at org.apache.cassandra.cql3.statements.Selection$FunctionSelector.compute(Selection.java:361)
    at org.apache.cassandra.cql3.statements.Selection$SelectionWithFunctions.handleRow(Selection.java:436)
    at org.apache.cassandra.cql3.statements.Selection$ResultSetBuilder.newRow(Selection.java:275)
    at org.apache.cassandra.cql3.statements.SelectStatement.handleGroup(SelectStatement.java:842)
    at org.apache.cassandra.cql3.statements.SelectStatement.process(SelectStatement.java:734)
    at org.apache.cassandra.cql3.statements.SelectStatement.processResults(SelectStatement.java:134)
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:128)
    at org.apache.cassandra.cql3.statements.SelectStatement.execute(SelectStatement.java:56)
    at org.apache.cassandra.cql3.QueryProcessor.processStatement(QueryProcessor.java:118)
    at org.apache.cassandra.cql3.QueryProcessor.process(QueryProcessor.java:128)
    at org.apache.cassandra.thrift.CassandraServer.execute_cql3_query(CassandraServer.java:1707)
    at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4074)
    at org.apache.cassandra.thrift.Cassandra$Processor$execute_cql3_query.getResult(Cassandra.java:4062)
    at org.apache.thrift.ProcessFunction.process(ProcessFunction.java:32)
    at org.apache.thrift.TBaseProcessor.process(TBaseProcessor.java:34)
    at org.apache.cassandra.thrift.CustomTThreadPoolServer$WorkerProcess.run(CustomTThreadPoolServer.java:199)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

Thanks,
Saravanan