Class RegrR2
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.AggregateFunction
dev.frostlake.functions.aggregate.RegrR2
REGR_R2(y, x) — coefficient of determination (R squared) over non-null (y, x) pairs (y dependent, x independent). See
RegrAccumulator.-
Nested Class Summary
Nested classes/interfaces inherited from class dev.frostlake.functions.AggregateFunction
AggregateFunction.Accumulator -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbinaryRejection(int position) The refusal a position gives a statically BINARY-typed value.booleanRejection(int position) The refusal this position gives a declared BOOLEAN argument.Creates the fresh, empty per-group state for one evaluation of this aggregate; the executor makes one per group (or per window partition) and never shares them.Computes the function's result over its already-evaluated argument values.intThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).intThe fewest arguments a call to this function may pass; fewer is an argument-count error.semiStructuredRejection(int position) REGR_R2 squares both of its inputs, so it reports the same internal multiplication the moment aggregates do and names the OFFENDING type on both sides whichever position it arrived in: liveREGR_R2(o, n)andREGR_R2(n, o)are each "Invalid argument types for function '*': (OBJECT, OBJECT)".temporalRejection(int position) A BOOLEAN, a temporal or a BINARY argument is refused at compile time in the multiplication's name with the type twice — "Invalid argument types for function '*': (DATE, DATE)" — exactly as a semi-structured one is: live reaches its internal sum of squares first (live-verified).Methods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, structuredRejection, temporalRejection, temporalRejection, textRejection, uuidRejection, vectorRejection
-
Constructor Details
-
RegrR2
public RegrR2()
-
-
Method Details
-
createAccumulator
Description copied from class:AggregateFunctionCreates the fresh, empty per-group state for one evaluation of this aggregate; the executor makes one per group (or per window partition) and never shares them.- Specified by:
createAccumulatorin classAggregateFunction- Returns:
- a new accumulator starting from this aggregate's empty-group state
-
evaluate
Description copied from class:BuiltInFunctionComputes the function's result over its already-evaluated argument values. A SQL NULL argument arrives as Javanull, and returningnullmakes the SQL result NULL.- Specified by:
evaluatein classBuiltInFunction- Parameters:
args- the argument values, in call order- Returns:
- the function's value for these arguments, or
nullfor SQL NULL
-
getMinArgCount
public int getMinArgCount()Description copied from class:BuiltInFunctionThe fewest arguments a call to this function may pass; fewer is an argument-count error.- Specified by:
getMinArgCountin classBuiltInFunction- Returns:
- the minimum accepted argument count
-
getMaxArgCount
public int getMaxArgCount()Description copied from class:BuiltInFunctionThe most arguments a call to this function may pass;Integer.MAX_VALUEmarks a variadic function (seeBuiltInFunction.isVariadic()).- Specified by:
getMaxArgCountin classBuiltInFunction- Returns:
- the maximum accepted argument count
-
semiStructuredRejection
REGR_R2 squares both of its inputs, so it reports the same internal multiplication the moment aggregates do and names the OFFENDING type on both sides whichever position it arrived in: liveREGR_R2(o, n)andREGR_R2(n, o)are each "Invalid argument types for function '*': (OBJECT, OBJECT)". The rest of the REGR family is deliberately NOT declared —REGR_COUNT,REGR_AVGXandREGR_SXXACCEPT an OBJECT in the y position live, andREGR_SLOPE/REGR_INTERCEPT/REGR_AVGY/REGR_SYYfail through a desugared TO_DOUBLE plan Frostlake does not have.- Overrides:
semiStructuredRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a semi-structured value, or
NONEwhen undeclared
-
temporalRejection
A BOOLEAN, a temporal or a BINARY argument is refused at compile time in the multiplication's name with the type twice — "Invalid argument types for function '*': (DATE, DATE)" — exactly as a semi-structured one is: live reaches its internal sum of squares first (live-verified).- Overrides:
temporalRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a temporal value; by default none
-
booleanRejection
Description copied from class:BuiltInFunctionThe refusal this position gives a declared BOOLEAN argument. Membership is declared per function and never assumed for a family: the whole NUMERIC family (NumericArgumentFunction) refuses a SQL BOOLEAN at compile time in every position — "Invalid argument types for function 'ABS': (BOOLEAN)",MOD(1, TRUE)listing "(NUMBER(1,0), BOOLEAN)" — while the SAME value inside a VARIANT converts to 1.0, and the conditionals (NULLIF(b, 0),NULLIFZERO(b)) take it. The rule reads the DECLARED type, like every channel here.- Overrides:
booleanRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a BOOLEAN value; by default none
-
binaryRejection
Description copied from class:BuiltInFunctionThe refusal a position gives a statically BINARY-typed value.A fifth question rather than a reuse of any of the four above, because BINARY sits on the opposite side of them: it is a scalar a text function is happy to be handed almost everywhere — live answers
LENGTH(bn),SUBSTR(bn, 1, 1),CONCAT(bn, bn)— where an OBJECT is refused. Only the functions that read their argument AS TEXT and would have to decode it refuse one, and they say so themselves:VALIDATE_UTF8(bn)andTRY_VALIDATE_UTF8(bn)are "Invalid argument types for function 'TRY_VALIDATE_UTF8': (BINARY(5))" while the same call over a VARCHAR, and even over a NUMBER, returns a value.The default is
NONE: undeclared means unconstrained, as for the other four.- Overrides:
binaryRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a BINARY value; by default none
-