Package dev.frostlake.executor
Class StarArgument
java.lang.Object
dev.frostlake.executor.StarArgument
A star written as a function ARGUMENT —
COUNT(*), HASH_AGG(t.*),
COUNT(* EXCLUDE (a)), COUNT(* ILIKE 'a%') — and what it stands for: the in-scope
columns it expands to, so that the call is then an ordinary multi-argument one (live-verified: a
qualified star expands to that relation's columns only, an EXCLUDE drops the named columns, an ILIKE
keeps the matching ones, and HASH_AGG(t.*) equals HASH_AGG(t.a, t.b, t.c)).
The three refusals are the account's: a qualifier naming no relation in scope is "Object 'X' does not exist or not authorized.", an EXCLUDE naming no column is "column 'X' does not exist", and one naming a column twice is "duplicate column name 'X'". A star that expands to nothing is left to the caller's arity rule, which spells "not enough arguments for function [COUNT()], expected 1, got 0".
The one star this does NOT expand is the bare, unqualified, unmodified * under COUNT,
which counts rows; every other shape — a qualifier, an EXCLUDE, an ILIKE, another aggregate — is
the written-out list, and a COUNT over that list counts the rows in which every column is non-NULL.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionThe columns this star stands for, as argument texts.expandReferences(Table table, Map<String, Table> aliasToTable, List<Table> allTables, boolean qualified) The columns this star names, as references — seeexpand(dev.frostlake.metastore.model.Table, java.util.Map<java.lang.String, dev.frostlake.metastore.model.Table>, java.util.List<dev.frostlake.metastore.model.Table>, boolean)— qualified by the relation each belongs to whenqualified, which a join needs to tell its sides apart.booleanisBare()Whether this is the bare*— no qualifier and no filter — that COUNT counts rows by.static StarArgumentof(FunctionCallExpression call) The star a star-shaped call node carries.static StarArgumentThe star of a star function argument, or null when the argument is not a star.static StarArgumentThe star of a star-call parse tree (COUNT(t.* EXCLUDE (a))).static StarArgumentThe star a window call's sole argument is, or null when the call's argument is not a star.
-
Constructor Details
-
StarArgument
- Parameters:
qualifier- the relation a qualified star names, canonical upper-cased, or nullexcludes- the EXCLUDE names, canonical upper-cased, in written order (duplicates kept)ilike- the ILIKE pattern between its quotes, or null
-
-
Method Details
-
of
The star of a star-call parse tree (COUNT(t.* EXCLUDE (a))). -
of
The star of a star function argument, or null when the argument is not a star. -
of
The star a star-shaped call node carries. -
ofWindowCall
The star a window call's sole argument is, or null when the call's argument is not a star. -
getQualifier
-
isBare
public boolean isBare()Whether this is the bare*— no qualifier and no filter — that COUNT counts rows by. -
expand
public List<String> expand(Table table, Map<String, Table> aliasToTable, List<Table> allTables, boolean qualified) The columns this star stands for, as argument texts.- Parameters:
table- the source relationaliasToTable- the FROM clause's alias map, or null for a single relationallTables- every relation in scope in FROM order, or null for a single relationqualified- whether to spell each column asRELATION.COLUMN(the plain path's texts and every echo) or as the bare column name (a single relation's row)- Returns:
- the argument texts, in relation order then column order
-
expandReferences
public List<ColumnReferenceExpression> expandReferences(Table table, Map<String, Table> aliasToTable, List<Table> allTables, boolean qualified) The columns this star names, as references — seeexpand(dev.frostlake.metastore.model.Table, java.util.Map<java.lang.String, dev.frostlake.metastore.model.Table>, java.util.List<dev.frostlake.metastore.model.Table>, boolean)— qualified by the relation each belongs to whenqualified, which a join needs to tell its sides apart.
-