Class TableFunctionArguments
Whether a table function accepts NAME => value at all is a property of the FUNCTION,
not of table functions in general. FLATTEN takes five named arguments; SPLIT_TO_TABLE takes none
and answers invalid argument for function [SPLIT_TO_TABLE] unexpected argument [STRING] at
position 1, for the very spelling its parameters are documented under; GENERATOR sits at the other
extreme and silently IGNORES anything it does not recognise, positional arguments included. So each
function's surface is listed here from measurement, and a function with no entry is left alone.
All of these are COMPILE-time refusals on live, raised before a row is read, and all but one carry the position of the function name.
-
Method Summary
Modifier and TypeMethodDescriptionstatic StringfirstPositionalParameter(String functionName) The parameter a leading positional argument fills.static TableFunctionParameterKindkindOfNamed(String functionName, String parameterName) The type a named parameter takes, or null when the function's surface has not been measured.static TableFunctionParameterKindkindOfPositional(String functionName, int index) The type theindex-th positional argument takes (0-based).static StringnameOfPositional(String functionName, int index) How live names a positional parameter in a type refusal — its 1-based position for most functions, but the parameter's own name for the ones that spell it out.static voidvalidateArity(String functionName, org.antlr.v4.runtime.Token nameToken, List<String> argumentTexts) Refuse a call whose positional argument count the function does not accept.static voidvalidateNames(String functionName, org.antlr.v4.runtime.Token nameToken, List<String> namesInOrder) Refuse a named argument the function does not take, and a required one the call never supplied.static voidvalidateQualification(String functionName, String schemaQualifier) Refuse a function that only exists under INFORMATION_SCHEMA when the call did not say so.
-
Method Details
-
validateQualification
Refuse a function that only exists under INFORMATION_SCHEMA when the call did not say so. The qualifier is checked rather than discarded: Frostlake resolved these by their last name part, so a bareQUERY_HISTORY(…)ran where live answers an invalid identifier.- Parameters:
schemaQualifier- the CANONICAL schema part written immediately before the function's own name (quoted spellings already unwrapped by the parse-tree reader), or empty when the call is unqualified
-
validateNames
public static void validateNames(String functionName, org.antlr.v4.runtime.Token nameToken, List<String> namesInOrder) Refuse a named argument the function does not take, and a required one the call never supplied.- Parameters:
functionName- the function as written, unqualified and upper-casednameToken- the function-name token, whose position the refusal reportsnamesInOrder- one entry per argument in call order — the name as written and upper-cased, or null where the argument was passed positionally
-
validateArity
public static void validateArity(String functionName, org.antlr.v4.runtime.Token nameToken, List<String> argumentTexts) Refuse a call whose positional argument count the function does not accept.SPLIT_TO_TABLE takes exactly two, and live spells the three refusals three different ways — including, for the one-argument call, a message that names the internal SPLIT rewrite the arguments were folded into (
[SPLIT('a,b' AS "1")]) and carries no position at all. The rewritten call renders a literal argument exactly as written, which is the shape this reproduces.- Parameters:
argumentTexts- the source text of each positional argument, in order
-
kindOfNamed
The type a named parameter takes, or null when the function's surface has not been measured. -
kindOfPositional
The type theindex-th positional argument takes (0-based). Live names such a parameter by its POSITION rather than its name —FLATTEN('[1,2,3]')isinvalid type [VARCHAR(7)] for parameter '1'— which is whatnameOfPositional(java.lang.String, int)spells, while the type rule itself is the named parameter's. -
nameOfPositional
How live names a positional parameter in a type refusal — its 1-based position for most functions, but the parameter's own name for the ones that spell it out. -
firstPositionalParameter
The parameter a leading positional argument fills. INPUT for most, but not all — TO_QUERY's first parameter is SQL, so a call naming it INPUT is missing its required argument.
-