Class ValueRange
EMPTY is the interval of no value — a NULL, a column with no rows — which every
operation keeps empty and a union ignores.
The interval decides the storage tag SYSTEM$TYPEOF prints after an exact NUMBER, which
is why it is carried at all: live tags a NUMBER(38,0) column holding 1 and 999 as SB2 on EVERY row,
the width of the widest value in the table, and never the width of the row's own value.
Beside its bounds an interval says whether the expression may also answer NULL, which the
statistics know of a column and which decides where the planner may stop a COALESCE. A known value
never does, arithmetic may only where an operand may, a union may where either side may, and
EMPTY is nothing but the NULL.
And it says whether a CONDITION over the expression may be settled by it at all (see
isOpaqueToConditions()). The planner reduces a COALESCE whose first argument cannot be NULL to
that argument; one it cannot reduce keeps its interval for the storage tag and for LEAST, GREATEST and
DECODE, but no comparison over it, or over anything computed from it, is settled: live leaves
IFF(COALESCE(n, 0) > 5, 3000.5, 1.5) open over a column holding a NULL, and settles it over
one holding none.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ValueRangeNo value at all: a NULL, or a column that holds nothing.static final ValueRangeWider than any tag tells apart, for a plan that always accumulates in sixteen bytes. -
Method Summary
Modifier and TypeMethodDescriptionabs()add(ValueRange other) below(ValueRange other, boolean orEqual) Whether every value of this interval lies below every value ofother— or at most, withorEqual: TRUE when every pair does, FALSE when none does, null when the intervals leave it open or either is empty.static ValueRangebetween(BigDecimal a, BigDecimal b) The interval between two bounds, in either order, holding no NULL.equalTo(ValueRange other) Whether this interval's values equalother's: TRUE for one shared point, FALSE when the two are disjoint, null when they leave it open or either is empty.static BigDecimalA runtime value read exactly, or null for one that is not an exact number — a NULL, a string that does not spell a number, a non-finite double.getMax()getMin()including(BigDecimal value) This interval widened to holdvalue; a null value widens nothing.booleanisEmpty()booleanWhether the expression may answer NULL beside its values; always true ofEMPTY.booleanWhether no condition over the expression is settled by this interval: the value came through a COALESCE (NVL, IFNULL) the planner could not reduce to its first argument, directly or through the arithmetic, casts and conditionals computed from it.The greatest distance from zero this interval reaches; zero when empty.multiply(ValueRange other) The interval of every product of one value from each side: the four corners bound it.negate()static ValueRangeof(BigDecimal value) The interval of one known value, which is never NULL, orEMPTYfor null.This interval, as one no condition is settled by;EMPTYstays itself.scaledBy(BigDecimal factor) Both bounds multiplied by a non-negative factor.subtract(ValueRange other) The interval mirrored about zero, so it holds every value of either sign this one can reach.toString()union(ValueRange other) The smallest interval holding both, NULL-able where either side is and opaque to conditions where either side is.withConditionOpacityOf(ValueRange source) This interval, opaque to conditions wheresourceis: for a value derived from it.withNullable(boolean mayBeNull) This interval, saying whether the expression may also answer NULL;EMPTYstays itself.
-
Field Details
-
EMPTY
No value at all: a NULL, or a column that holds nothing. Takes the narrowest tag. -
WIDEST
Wider than any tag tells apart, for a plan that always accumulates in sixteen bytes.
-
-
Method Details
-
of
The interval of one known value, which is never NULL, orEMPTYfor null. -
between
The interval between two bounds, in either order, holding no NULL. -
exactOf
A runtime value read exactly, or null for one that is not an exact number — a NULL, a string that does not spell a number, a non-finite double. -
isEmpty
public boolean isEmpty() -
getMin
-
getMax
-
isNullable
public boolean isNullable()Whether the expression may answer NULL beside its values; always true ofEMPTY. -
isOpaqueToConditions
public boolean isOpaqueToConditions()Whether no condition over the expression is settled by this interval: the value came through a COALESCE (NVL, IFNULL) the planner could not reduce to its first argument, directly or through the arithmetic, casts and conditionals computed from it. The bounds and the nullability still stand. -
withNullable
This interval, saying whether the expression may also answer NULL;EMPTYstays itself. -
opaqueToConditions
This interval, as one no condition is settled by;EMPTYstays itself. -
withConditionOpacityOf
This interval, opaque to conditions wheresourceis: for a value derived from it. -
including
This interval widened to holdvalue; a null value widens nothing. -
union
The smallest interval holding both, NULL-able where either side is and opaque to conditions where either side is. An empty side adds no value, only its NULL; an unknown (null) side contributes nothing. -
negate
-
abs
-
add
-
subtract
-
multiply
The interval of every product of one value from each side: the four corners bound it. -
scaledBy
Both bounds multiplied by a non-negative factor. -
symmetric
The interval mirrored about zero, so it holds every value of either sign this one can reach. -
below
Whether every value of this interval lies below every value ofother— or at most, withorEqual: TRUE when every pair does, FALSE when none does, null when the intervals leave it open or either is empty. -
equalTo
Whether this interval's values equalother's: TRUE for one shared point, FALSE when the two are disjoint, null when they leave it open or either is empty. -
magnitude
The greatest distance from zero this interval reaches; zero when empty. -
toString
-