Package dev.frostlake.functions.window
Class WindowFunctionArity
java.lang.Object
dev.frostlake.functions.window.WindowFunctionArity
How many arguments each window function takes, and live's two sentences for a call that gets it
wrong. Every bound here is live-measured:
ROW_NUMBER RANK DENSE_RANK PERCENT_RANK CUME_DIST 0 RANK(a) is "expected 0, got 1" LEAD LAG 1 to 3 LAG(a,1,0) runs; a fourth is refused NTILE FIRST_VALUE LAST_VALUE 1 CONDITIONAL_TRUE_EVENT CONDITIONAL_CHANGE_EVENT 1 NTH_VALUE 2 NTH_VALUE(a) is "expected 2, got 1"
★ THE TWO SENTENCES ARE PUNCTUATED DIFFERENTLY, which is measured rather than tidied: the too-few one carries a comma after the bracket and the too-many one does not.
★ ARITY OUTRANKS EVERYTHING ELSE ABOUT THE CALL. LEAD() is refused for its argument count
whether or not it carries an OVER clause — the missing specification is never reached — and the
refusal is POSITIONED on the call itself, where the missing-specification sentence carries no
position at all.
★ WHAT IS DELIBERATELY ABSENT: RATIO_TO_REPORT, whose refusal live words in SUM's name rather than its own, and the dual-role aggregates (SUM, COUNT, AVG, MIN, MAX), which are answerable with no window at all and carry an aggregate's arity rules instead.
-
Method Summary
-
Method Details
-
isMeasured
Whether this name's argument count is one we know how to judge. -
refusal
Live's refusal for a call of the wrong arity, or null when the count is legal.- Parameters:
name- the upper-cased function nameecho- the call as the plan prints it, brackets excludedgiven- how many arguments were written- Returns:
- the refusal detail, or null
-