Class OperatorFunctionNames

java.lang.Object
dev.frostlake.functions.OperatorFunctionNames

public final class OperatorFunctionNames extends Object
Built-in function names Snowflake gives to operators and grammar forms rather than to callable functions — +, IS NULL, ||, LIKE_ANY, COUNT(*), … A real account lists all of them in SHOW BUILTIN FUNCTIONS (the 30 non-word names it returns are != % * + - / : < <= <> = > >= COUNT(*) COUNT_INTERNAL(*) [] ||, the four INTERVAL … arithmetic entries, IS NULL, IS NOT NULL, OBJECT_CONSTRUCT(*), OBJECT_CONSTRUCT_KEEP_NULL(*) and OBJECT_CONSTRUCT_KEEP_NULL_STRUCTURED(*), alongside word-shaped operator names such as AND, OR, NOT, BETWEEN, IN, LIKE_ANY and DIV).

Unlike the other name sets feeding FunctionRegistry.allDispatchableNames(), this one cannot be load-bearing for dispatch — the grammar implements these, not a name lookup. Membership is therefore a deliberate, curated claim with two conditions, and OperatorFunctionNamesTest re-checks the second one for every entry:

  1. Snowflake lists the name (checked against the 926 names its SHOW BUILTIN FUNCTIONS returned), and
  2. Frostlake implements the corresponding operator form.

Names that fail either test stay out. DIV is the instructive one: Snowflake lists it, but it is not invocable there either (SELECT DIV(10, 3) answers "Unsupported feature 'DIV'") and Frostlake has no DIV in any form — 10 DIV 3 is a syntax error — so it is not listed. ILIKE_ALL is absent from Snowflake's own listing and rejected by it ("Unknown function ILIKE_ALL"), matching Frostlake's grammar, which allows ILIKE ANY but not ILIKE ALL. The interval-arithmetic quartets are split for the same reason: Frostlake evaluates <timestamp> + INTERVAL '1 day' and the matching subtraction, so the PLUS and MINUS entries are listed, but INTERVAL '1 day' * 2 and INTERVAL '2 day' / 2 do not parse, so MULTIPLY and DIVIDE are not.

These names are also why LIKE_ANY is genuinely supported rather than merely listed: Snowflake's LIKE_ANY is the function name of the x LIKE ANY (…) operator (SELECT LIKE_ANY('abc', 'a%') answers "not enough arguments for function ['abc' LIKE_ANY 'a%'], expected 3, got 2"), and Frostlake evaluates that operator.

  • Method Details

    • contains

      public static boolean contains(String name)
      Whether this name is one of the operator / grammar forms the listing declares.
    • names

      public static SortedSet<String> names()
      Every operator-implemented built-in name, sorted.