Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



Ahrnndz avatar image
Ahrnndz asked Erick Ramirez answered

What is the syntax for the "greater than" operator on Date types in Gremlin?

I have a DSE 6.8.9 server running in a docker container with DSE Graph enabled. I have created a simple graph using the following schema commands inside a gremlin console:

schema.vertexLabel('test_time').ifNotExists().partitionBy('tt_id', Int)property('dtime', Date).create()
g.addV('test_time').property('tt_id',6001).property('dtime','2010-10-02' as LocalDate).iterate()

When I go to query for this vertex from the console the following query works without issue:

g.V().hasLabel('test_time').has('dtime', LocalDate.parse('2010-10-02'))

However an error is thrown when I use a predicate step such as gt() or lte() like in the command below:

g.V().hasLabel('test_time').has('dtime', gt(LocalDate.parse('2010-10-02')))


Invalid Date String:'2010-10-02'
Type ':help' or ':h' for help.
Display stack trace? [yN]Y
org.apache.solr.common.SolrException: Invalid Date String:'2010-10-02'
        at org.apache.solr.util.DateMathParser.parseMath(
        at org.apache.solr.schema.TrieField.getRangeQuery(
        at org.apache.solr.parser.SolrQueryParserBase.getRangeQuery(
        at org.apache.solr.parser.QueryParser.Term(
        at org.apache.solr.parser.QueryParser.Clause(
        at org.apache.solr.parser.QueryParser.Query(
        at org.apache.solr.parser.QueryParser.TopLevelQuery(
        at org.apache.solr.parser.SolrQueryParserBase.parse(
        at org.apache.solr.handler.component.QueryComponent.prepare(
        at org.apache.solr.handler.component.SearchHandler.handleRequestBody(
        at org.apache.solr.handler.RequestHandlerBase.handleRequest(
        at org.apache.solr.core.SolrCore.execute(
        at com.datastax.bdp.cassandra.cql3.SolrQueryOperationFactory.lambda$executeSolrStatement$1(
        at io.reactivex.internal.operators.single.SingleFromCallable.subscribeActual(
        at io.reactivex.Single.subscribe(
        at io.reactivex.internal.operators.single.SingleSubscribeOn$
        at java.util.concurrent.ThreadPoolExecutor.runWorker(
        at java.util.concurrent.ThreadPoolExecutor$

Why would the predicate step cause the Date String to become invalid and whats the correct syntax to use?

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered

It appears as though graph traversals that have an inequality criteria (such as greater than or less than) do not work when it involves querying the DSE Search index on a Date type.

Please log a ticket with DataStax Support so we can gather additional information about your cluster to assist with the investigation on the issue with our Engineering team. Cheers!

10 |1000

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.