Class ObjectConstruct
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.scalar.semistructured.ObjectConstruct
- Direct Known Subclasses:
ObjectConstructKeepNull
OBJECT_CONSTRUCT(k1, v1, k2, v2, ...) — builds an object from key-value pairs.
Also supports OBJECT_CONSTRUCT(*) which is handled as no-args → empty object.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static ObjectComputes the function's result over its already-evaluated argument values.fileRejection(int position) A FILE splits the two halves differently again: it NESTS as a value and is refused as a KEY.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.structuredRejection(int position) A STRUCTURED value is refused in either half of the alternating argument list, but with a different sentence in each.Methods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, binaryRejection, booleanRejection, evaluate, geoRejection, getName, getReturnType, isVariadic, refusesMissingArgumentsByType, semiStructuredRejection, temporalRejection, temporalRejection, temporalRejection, textRejection, uuidRejection, vectorRejection
-
Constructor Details
-
ObjectConstruct
public ObjectConstruct() -
ObjectConstruct
-
-
Method Details
-
structuredRejection
A STRUCTURED value is refused in either half of the alternating argument list, but with a different sentence in each. Live,OBJECT_CONSTRUCT('a', so)andOBJECT_CONSTRUCT('a', 1, 'b', so)are "Function OBJECT_CONSTRUCT does not support OBJECT(x VARCHAR(16777216)) argument type" (vendor code 2016) whileOBJECT_CONSTRUCT(so, 1)— the same value used as a KEY — appends " for keys" and carries vendor code 2270 instead. The plain types are accepted in the value half (OBJECT_CONSTRUCT('a', o)nests the object), so this is a divergence and not a general semi-structured rule.Inherited by
OBJECT_CONSTRUCT_KEEP_NULL, which subclasses this and was measured to behave identically.- Overrides:
structuredRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the extra refusal this position gives a structured value, or
NONEwhen undeclared
-
fileRejection
A FILE splits the two halves differently again: it NESTS as a value and is refused as a KEY. Live,OBJECT_CONSTRUCT('a', f)returns{"a":{"CONTENT_TYPE":…}}whileOBJECT_CONSTRUCT(f, 1)is "Function OBJECT_CONSTRUCT does not support FILE argument type for keys" — the key sentence a structured value gets, with the value half left alone.- Overrides:
fileRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked about- Returns:
- the refusal this position gives a FILE value; by default, the semi-structured answer
-
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
-
build
-
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
-