Class TimeFunction
java.lang.Object
dev.frostlake.functions.BuiltInFunction
dev.frostlake.functions.scalar.conversion.ToTime
dev.frostlake.functions.scalar.conversion.TimeFunction
TIME(<expr>) — the TIME synonym, which is not TO_TIME. The account resolves it among
one-argument overloads — a text, a VARIANT, a timestamp — so it reads a text exactly as TO_TIME does
and everything else its own way (all live-verified):
TIME('10:00:00') 10:00:00
TIME(TRUE) Time 'true' is not recognized a BOOLEAN reads as its text
TIME(123), TIME(n) Failed to cast variant value 123 to TIME a NUMBER goes by a VARIANT
TIME(d) 00:00:00 a DATE is its midnight
TIME(ts), TIME(ltz), TIME(tz) the wall clock
TIME(o), TIME(a) Failed to cast variant value {"a":1} to TIME
TIME(PARSE_JSON('"10:00"')) 10:00:00 a VARIANT's text, or its TIME
TIME(PARSE_JSON('"abc"')) Failed to cast variant value "abc" to TIME
TIME(tm) incompatible types: [TIME(9)] and [TIMESTAMP_LTZ(9)]
TIME(bn) Invalid argument types for function 'TIME': (BINARY(8388608))
TIME('10:00', 'HH24:MI') too many arguments for function [...] expected 1, got 2
TIME() Invalid argument types for function 'TIME': ()
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbinaryRejection(int position) A BINARY matches no overload: "Invalid argument types for function 'TIME': (BINARY(1))".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()).booleanWhether a call with fewer arguments thanBuiltInFunction.getMinArgCount()is refused by its argument types rather than by its count.temporalRejection(int position, int argumentCount, DataType temporal) A TIME is refused on its way to the TIMESTAMP_LTZ overload; a DATE and a timestamp are read.Methods inherited from class dev.frostlake.functions.scalar.conversion.ToTime
getMinArgCountMethods inherited from class dev.frostlake.functions.BuiltInFunction
approximateRejection, booleanRejection, evaluate, fileRejection, geoRejection, getName, getReturnType, isVariadic, semiStructuredRejection, structuredRejection, temporalRejection, temporalRejection, textRejection, uuidRejection, vectorRejection
-
Constructor Details
-
TimeFunction
public TimeFunction()
-
-
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. -
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()).- Overrides:
getMaxArgCountin classToTime- Returns:
- the maximum accepted argument count
-
refusesMissingArgumentsByType
public boolean refusesMissingArgumentsByType()Description copied from class:BuiltInFunctionWhether a call with fewer arguments thanBuiltInFunction.getMinArgCount()is refused by its argument types rather than by its count. A function the account resolves among overloads has no single count to report: live,TIME()is "Invalid argument types for function 'TIME': ()" whereLOG(10)is "not enough arguments for function [LOG(10)], expected 2, got 1".- Overrides:
refusesMissingArgumentsByTypein classBuiltInFunction- Returns:
- true when the refusal lists the argument types; false by default
-
binaryRejection
A BINARY matches no overload: "Invalid argument types for function 'TIME': (BINARY(1))".- 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
-
temporalRejection
public SemiStructuredRejection temporalRejection(int position, int argumentCount, DataType temporal) A TIME is refused on its way to the TIMESTAMP_LTZ overload; a DATE and a timestamp are read.- Overrides:
temporalRejectionin classBuiltInFunction- Parameters:
position- the zero-based argument position being asked aboutargumentCount- how many arguments the call carriestemporal- the argument's declared temporal type- Returns:
- the refusal this position gives that temporal value
-