- Record Components:
equations- the equations, in source order; never emptygroupingKeys- thePERcolumns a fit is made per; empty to solve row by rowtolerance- theWITHINconvergence tolerance, positive; empty for the defaultmaxRounds- theMAX … ROUNDSiteration cap, at least 1; empty for the defaultstarts- theSTARTvalues, at most one per column; empty to start at 1input- the relation whose rows are completed; must not be nulllocation- the source location of this node; never null
- All Implemented Interfaces:
RelNode
left = right.
For each input row, the participating columns are the distinct
attribute references appearing anywhere in the equations. Those that are
NULL in that row are its unknowns, so the direction is per row — the same
equation fills principal in one row and rate in another, depending
on which is blank. A row is solved when it has exactly as many unknowns as there are
equations, by the cheapest strategy that applies: a single equation whose unknown
appears once is inverted by rearranging it; equations linear in the unknowns are
solved by elimination; anything else is solved by Newton's method, every unknown
starting at 1 unless starts says otherwise. A row that cannot be posed — the wrong number of unknowns, or a
singular linear system — passes through unchanged; a row that is posed but on which
the iteration does not converge is an error.
With groupingKeys (PER k, …) the equations are fitted across each
group of rows rather than solved row by row: the unknowns are the participating
columns that are NULL in every row of the group, every row in which the other
participating columns are all present is an observation, and the unknowns are chosen
to minimise the sum of squared residuals over the observations — directly when the
equations are linear in them, by Gauss–Newton otherwise. The fitted values are
written into every row of the group. Grouping makes the operator blocking.
tolerance (WITHIN ε) and maxRounds (MAX n ROUNDS)
govern the iteration, and are left empty for the engine's defaults; an iteration
stops when no unknown moves by more than the tolerance in a round. starts
(START u = e, …) gives an unknown's first estimate as an expression over the
row's known columns, so a query can choose which root a search reaches; over a
PER group it must be a constant.
The output schema equals the input schema — solve fills holes, it never
adds or removes columns. The sides are restricted to arithmetic (column references,
numeric literals, + − × ÷, unary minus, and calls to user-defined scalar
functions whose bodies are such arithmetic). This operator runs in-engine and never
pushes down.
Example: SOLVE total = principal * rate (Loans) fills whichever of
total, principal, or rate is blank in each loan row.
-
Constructor Summary
ConstructorsConstructorDescriptionConvenience constructor for a single equation; usesSourceLocation.UNKNOWN.Convenience constructor for tests; usesSourceLocation.UNKNOWN.SolveNode(List<SolveEquation> equations, List<String> groupingKeys, Optional<BigDecimal> tolerance, Optional<Integer> maxRounds, List<SolveStart> starts, RelNode input, SourceLocation location) Creates an instance of aSolveNoderecord class. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(RelNodeVisitor<R> visitor) final booleanIndicates whether some other object is "equal to" this one.Returns the value of theequationsrecord component.Returns the value of thegroupingKeysrecord component.final inthashCode()Returns a hash code value for this object.input()Returns the value of theinputrecord component.location()Returns the value of thelocationrecord component.Returns the value of themaxRoundsrecord component.starts()Returns the value of thestartsrecord component.Returns the value of thetolerancerecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.darkcollective.relix.ast.RelNode
children, mapChildren, materializationMode, prettyPrint, prettyPrint
-
Constructor Details
-
SolveNode
public SolveNode(List<SolveEquation> equations, List<String> groupingKeys, Optional<BigDecimal> tolerance, Optional<Integer> maxRounds, List<SolveStart> starts, RelNode input, SourceLocation location) Creates an instance of aSolveNoderecord class.- Parameters:
equations- the value for theequationsrecord componentgroupingKeys- the value for thegroupingKeysrecord componenttolerance- the value for thetolerancerecord componentmaxRounds- the value for themaxRoundsrecord componentstarts- the value for thestartsrecord componentinput- the value for theinputrecord componentlocation- the value for thelocationrecord component
-
SolveNode
Convenience constructor for tests; usesSourceLocation.UNKNOWN. -
SolveNode
Convenience constructor for a single equation; usesSourceLocation.UNKNOWN.
-
-
Method Details
-
accept
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
equations
Returns the value of theequationsrecord component.- Returns:
- the value of the
equationsrecord component
-
groupingKeys
Returns the value of thegroupingKeysrecord component.- Returns:
- the value of the
groupingKeysrecord component
-
tolerance
Returns the value of thetolerancerecord component.- Returns:
- the value of the
tolerancerecord component
-
maxRounds
Returns the value of themaxRoundsrecord component.- Returns:
- the value of the
maxRoundsrecord component
-
starts
Returns the value of thestartsrecord component.- Returns:
- the value of the
startsrecord component
-
input
Returns the value of theinputrecord component.- Returns:
- the value of the
inputrecord component
-
location
Returns the value of thelocationrecord component.
-