Class ToDecfloat
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.scalar.conversion.ToDecfloat
TO_DECFLOAT(expr [, format]) — a 38-digit decimal float on the account, carried here as a DOUBLE,
the engine's stand-in for DECFLOAT (a DECFLOAT column is one too). It is not TO_DOUBLE: it takes a
BOOLEAN, where TO_DOUBLE(TRUE) is refused while the statement compiles, and words its own failures
(all live-verified):
TO_DECFLOAT(TRUE) 1 TO_DECFLOAT(FALSE) 0
TO_DECFLOAT(' 1.5 ') 1.5 the text is trimmed
TO_DECFLOAT('abc') Numeric value 'abc' is not recognized '', 'NaN' and 'inf' alike
TO_DECFLOAT('1,234.5', '9,999.9') 1234.5 a format over a text source
TO_DECFLOAT('123', '99') Can't parse '123' as number with format '99' the model's width
TO_DECFLOAT('1e5', '9e9') Bad input format model '9e9' for DECFLOAT: invalid numeric format
keyword: 'e9' see NumericFormatModel
TO_DECFLOAT(PARSE_JSON('"1.5"')) 1.5 a VARIANT's number, boolean or numeric text
TO_DECFLOAT(PARSE_JSON('[1]')) Failed to cast variant value [1] to DECFLOAT
TO_DECFLOAT(TO_VARIANT(1.5::FLOAT)) DecFloat not supported a VARIANT's DOUBLE
TO_DECFLOAT(1e308::FLOAT * 10) Decfloat out of representable range, operation: TO_DECFLOAT(inf)
A DATE, TIME, TIMESTAMP, BINARY, OBJECT or ARRAY source is refused while the statement compiles, the conversion sentence naming 'TO_DECFLOAT', and a format beside a source that is no text is too many arguments; neither reaches a row.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionComputes 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.Methods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, binaryRejection, booleanRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, semiStructuredRejection, structuredRejection, temporalRejection, temporalRejection, temporalRejection, textRejection, uuidRejection, vectorRejection
-
Constructor Details
-
ToDecfloat
public ToDecfloat()
-
-
Method Details
-
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
-