Search code examples
dategraphnullgremlintinkerpop

How to set the date as NULL or INFINITY in apache tinkerpop gremlin?


How to set the date as NULL or INFINITY in apache tinkerpop gremlin?

I have a field - start_date and end_date. end_date is optional and it's unknown. In a relational database, we can set either NULL or INFINITY.

Is there any recommended value?


Solution

  • There is currently no way to store INFINITY or NULL. You have a few options.

    1. If working with epoch offsets perhaps use min-int -(2**63) or max-int (2**63)-1 as the definition for "no valid date set".
    2. If working with ISO 8601 datetime dates then perhaps choose a date that you are confident is beyond the scope of your applications lifetime and use that. Just remember to avoid repeating the Y2K problem :-) For example g.addV('event').property('endDate',datetime('9999-12-31'))