java.lang.Object
com.darkcollective.relix.processor.eval.TemporalDistance

public final class TemporalDistance extends Object
The absolute temporal distance between two values — the metric that complements ValueComparator's order, for the operators that bound how far apart two rows may be (the AS-OF join's WITHIN tolerance).

The distance is defined as the language's own subtraction rather than restated as a second table of type pairs, so the two cannot drift: a distance exists exactly where a − b yields a DURATION, which is between two TIMESTAMPs, two DATEs (a whole-day span) and two DURATIONs. That inherits the same string coercion the comparator applies, so a text cell measured against a typed temporal value reads as the value it spells.

Everything else — two strings, two numbers, a TIMESTAMP against a DURATION, or two TIMEs, whose difference the arithmetic algebra deliberately leaves undefined because a wall-clock span wraps — has no distance, reported as an empty result so the caller can phrase the objection in its own terms.

  • Method Details

    • between

      public static Optional<Duration> between(Value a, Value b)
      Returns the absolute distance between two non-NULL values, or empty when no distance is defined for the pair.
      Parameters:
      a - the first value
      b - the second value
      Returns:
      the absolute distance, or empty when the pair has none