Class FoldedValues

java.lang.Object
dev.frostlake.executor.expressions.FoldedValues

public final class FoldedValues extends Object
A value PRESENTED at the type a conditional fold declares — the conversion the account plans as a CAST on every branch, so the branch handed back reads at the fold whatever it was written as:
   LAG(a, 1, 0)      over a NUMBER(10,2)     0 reads 0.00, a reads 1.00
   LAG(a, 1, 1.555)  over a NUMBER(10,2)     the fold is NUMBER(11,3): a reads 1.000
   LAG(a, 1, TRUE)   over a NUMBER(10,2)     the fold is BOOLEAN: 1.00 reads true
   LAG(d, 1, ts)     over a DATE             the fold is TIMESTAMP_NTZ: d reads 2020-01-01 00:00:00.000
   LAG(a, 1, 'x')    over a NUMBER(10,2)     the fold is NUMBER(18,5): 'x' is refused as not a number
 

An exact NUMBER fold sets the scale; a FLOAT fold takes the double; a BOOLEAN or temporal fold casts; a string fold leaves the value alone. No fold, no change.

  • Method Details

    • presented

      public static Object presented(Object value, DataType declared)
      Parameters:
      value - the branch's own value
      declared - the fold, or null when none is known
      Returns:
      the value at the fold