Package dev.frostlake.functions
Enum Class SemiStructuredRejection
- All Implemented Interfaces:
Serializable,Comparable<SemiStructuredRejection>,Constable
HOW a built-in refuses a statically OBJECT- or ARRAY-typed argument. Snowflake does not phrase this
rejection one way: six distinct message shapes have now been measured live over populated OBJECT,
ARRAY and STRUCTURED columns, and they carry different SQLSTATEs, so a function has to
say which one it uses rather than the rule guessing.
The alternative — one message with the function name substituted in — was tried against the
account and does not hold: SUM(o) and MEDIAN(o) disagree on the sentence, the
SQLSTATE and the vendor code alike.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescription"Invalid argument types for function 'SUM': (OBJECT)" — SQLSTATE 42P13, vendor code 1044.The boolean aggregates' conversion refusal —invalid type [TO_BOOLEAN(x)] for parameter 'TO_BOOLEAN', the argument quoted from the plan, no position — for a FLOAT, a temporal, a BINARY or a structured value the account's TO_BOOLEAN cannot take (live-verified).The product of a call's TWO arguments, refused in the multiplication's name with the X — the second argument — listed first:REGR_SXY(bo, n)over a BOOLEAN and a NUMBER(10,2) is "Invalid argument types for function '*': (NUMBER(10,2), BOOLEAN)", and with the arguments swapped "(BOOLEAN, NUMBER(10,2))" — live reaches its sum of x·y first (live-verified).The two-argument statistics — CORR, the covariances, the regressions bar REGR_R2 — convert each argument to a DOUBLE inside a null guard on the OTHER argument, and it is that conversion live refuses, quoting the guarded plan back and naming TO_DOUBLE as the parameter:CORR(bo, n)over a BOOLEAN and a NUMBER is "invalid type [TO_DOUBLE(IFF(AT.N IS NULL, SYSTEM$NULL_TO_BOOLEAN(NULL), AT.BO))] for parameter 'TO_DOUBLE'" — unpositioned, the null substitute spelled after the refused argument's family."incompatible types: [OBJECT] and [NUMBER(9,0)]" — SQLSTATE 42846, vendor code 1010.INSERT(s, p, l, i) judged as theSUBSTR(s, 1, p - 1) || i || SUBSTR(s, p + l)the account plans it as: a BINARY position is the subtraction's refusal, "'-': (BINARY(8388608), NUMBER(1,0))", a BINARY length the addition's, "'+': (NUMBER(1,0), BINARY(8388608))", and a BINARY beside any other family the concatenation's, the base listed twice around the insertion: "'||': (BINARY(8388608), VARCHAR(1), BINARY(8388608))"."invalid type [TO_VARCHAR(ST.SO)] for parameter 'TO_VARCHAR'" — SQLSTATE 22023, vendor code 1007."Invalid argument types for function '*': (OBJECT, OBJECT)" — SQLSTATE 42P13, vendor code 1044.Undeclared: this position constrains nothing.REPEAT(s, n) judged as theLPAD('', n * LENGTH(s), s)the account plans it as.SPACE(n) judged as theLPAD('', n, ' ')the account plans it as: "Invalid argument types for function 'LPAD': (VARCHAR(1), BINARY(8388608), VARCHAR(1))" for a BINARY count, at the call (live-verified)."incompatible types: [TIME(9)] and [TIMESTAMP_LTZ(9)]" — SQLSTATE 42846, no position."Function ARRAY_CONSTRUCT does not support OBJECT(x VARCHAR(16777216)) argument type" — SQLSTATE 22000, vendor code 2016."Function OBJECT_CONSTRUCT does not support OBJECT(x VARCHAR(16777216)) argument type for keys" — SQLSTATE 22000, vendor code 2270. -
Method Summary
Modifier and TypeMethodDescriptionstatic SemiStructuredRejectionReturns the enum constant of this class with the specified name.static SemiStructuredRejection[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NONE
Undeclared: this position constrains nothing. The default for every function, so a built-in that has never been measured against live Snowflake cannot cause a false rejection. -
ARGUMENT_TYPES
"Invalid argument types for function 'SUM': (OBJECT)" — SQLSTATE 42P13, vendor code 1044. The argument-type list names EVERY argument as written, so the offending position is visible in context. The text family (TextArgumentFunction) and the numeric family (NumericArgumentFunction) both refuse this way, as doSUM,AVGand theBIT*_AGGaggregates. -
INCOMPATIBLE_TYPES
"incompatible types: [OBJECT] and [NUMBER(9,0)]" — SQLSTATE 42846, vendor code 1010. The ordering-by-value aggregates (MEDIANand the percentiles) report the value they were handed against the fixed numeric type they accumulate into. TheNUMBER(9,0)is a CONSTANT, measured rather than assumed:PERCENTILE_CONT(0.9),PERCENTILE_CONT(0.25)andPERCENTILE_DISC(0.9999)all name exactlyNUMBER(9,0), so it is not derived from the requested fraction. -
MULTIPLY_OPERANDS
"Invalid argument types for function '*': (OBJECT, OBJECT)" — SQLSTATE 42P13, vendor code 1044. The moment aggregates (STDDEV,VARIANCE,SKEW,KURTOSISand their variants) reach their sum of squares before they reach any type check, so live reports the internal MULTIPLICATION and lists the one offending argument TWICE — the function's own name never appears. -
INVALID_TYPE_PARAMETER
"invalid type [TO_VARCHAR(ST.SO)] for parameter 'TO_VARCHAR'" — SQLSTATE 22023, vendor code 1007. The CONVERSION shape: the whole CALL is quoted back rather than its argument types listed, and the parameter named is the conversion the call routes through, which is the written function name (TO_CHAR(so)names 'TO_CHAR'). Measured forTO_VARCHARandTO_CHARover all three structured kinds; the same sentence covers the CAST spellings, which are not function calls and are produced by their own rule. -
DOUBLE_CONVERSION_PARAMETER
The two-argument statistics — CORR, the covariances, the regressions bar REGR_R2 — convert each argument to a DOUBLE inside a null guard on the OTHER argument, and it is that conversion live refuses, quoting the guarded plan back and naming TO_DOUBLE as the parameter:CORR(bo, n)over a BOOLEAN and a NUMBER is "invalid type [TO_DOUBLE(IFF(AT.N IS NULL, SYSTEM$NULL_TO_BOOLEAN(NULL), AT.BO))] for parameter 'TO_DOUBLE'" — unpositioned, the null substitute spelled after the refused argument's family. Every family but the numbers, the strings and VARIANT is refused this way, at either position. -
CROSS_PRODUCT_OPERANDS
The product of a call's TWO arguments, refused in the multiplication's name with the X — the second argument — listed first:REGR_SXY(bo, n)over a BOOLEAN and a NUMBER(10,2) is "Invalid argument types for function '*': (NUMBER(10,2), BOOLEAN)", and with the arguments swapped "(BOOLEAN, NUMBER(10,2))" — live reaches its sum of x·y first (live-verified). The squares family lists one argument twice instead (MULTIPLY_OPERANDS). -
UNSUPPORTED_ARGUMENT_TYPE
"Function ARRAY_CONSTRUCT does not support OBJECT(x VARCHAR(16777216)) argument type" — SQLSTATE 22000, vendor code 2016. The same sentence the ordering aggregates use, reached here by the semi-structured CONSTRUCTORS: live,ARRAY_CONSTRUCT,ARRAY_CONSTRUCT_COMPACT,OBJECT_CONSTRUCTandOBJECT_CONSTRUCT_KEEP_NULLrefuse a STRUCTURED value in ANY position this way while taking a plain OBJECT or ARRAY happily. -
UNSUPPORTED_KEY_ARGUMENT_TYPE
"Function OBJECT_CONSTRUCT does not support OBJECT(x VARCHAR(16777216)) argument type for keys" — SQLSTATE 22000, vendor code 2270.UNSUPPORTED_ARGUMENT_TYPEwith a different tail and a different vendor code, used for the KEY half ofOBJECT_CONSTRUCT's alternating argument list: live,OBJECT_CONSTRUCT(so, 1)says "for keys" whereOBJECT_CONSTRUCT('a', so)does not. -
BOOLEAN_CONVERSION_PARAMETER
The boolean aggregates' conversion refusal —invalid type [TO_BOOLEAN(x)] for parameter 'TO_BOOLEAN', the argument quoted from the plan, no position — for a FLOAT, a temporal, a BINARY or a structured value the account's TO_BOOLEAN cannot take (live-verified). -
REPEAT_REWRITE_OPERANDS
REPEAT(s, n) judged as theLPAD('', n * LENGTH(s), s)the account plans it as. The product is typed first, LENGTH declaring NUMBER(18,0), so a count the multiplication refuses is refused in the product's words — "Invalid argument types for function '*': (BINARY(8388608), NUMBER(18,0))" — and a BINARY string by LPAD, the empty pad listed as VARCHAR(1) and the product at its own width: "Invalid argument types for function 'LPAD': (VARCHAR(1), NUMBER(19,0), BINARY(8388608))" for a count of 2. SQLSTATE 42P13, at the call (live-verified). -
SPACE_REWRITE_OPERANDS
SPACE(n) judged as theLPAD('', n, ' ')the account plans it as: "Invalid argument types for function 'LPAD': (VARCHAR(1), BINARY(8388608), VARCHAR(1))" for a BINARY count, at the call (live-verified). -
INSERT_REWRITE_OPERANDS
INSERT(s, p, l, i) judged as theSUBSTR(s, 1, p - 1) || i || SUBSTR(s, p + l)the account plans it as: a BINARY position is the subtraction's refusal, "'-': (BINARY(8388608), NUMBER(1,0))", a BINARY length the addition's, "'+': (NUMBER(1,0), BINARY(8388608))", and a BINARY beside any other family the concatenation's, the base listed twice around the insertion: "'||': (BINARY(8388608), VARCHAR(1), BINARY(8388608))". Two binaries, or a NULL insertion, concatenate — so this is the one shape that can find its call legal (live-verified). -
TIME_TO_TIMESTAMP_LTZ
"incompatible types: [TIME(9)] and [TIMESTAMP_LTZ(9)]" — SQLSTATE 42846, no position. The TIME synonym takes a text, a VARIANT or a timestamp, a DATE reading as its midnight; a TIME-typed argument is carried toward the TIMESTAMP_LTZ form and refused there, its own precision spelled — over a TIME(3) column the sentence lists [TIME(3)] (live-verified).
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-