Class QualifiedName

java.lang.Object
dev.frostlake.metastore.QualifiedName

public final class QualifiedName extends Object
An object's qualified name as its ordered identifier parts (db.schema.name).

Prefer building it from the parse tree — QualifiedName.of(qualifiedNameParts(ctx)) — so the structure comes straight from the grammar's identifier list. parse(String) is the fallback for a name that is only ever available as a flattened / runtime string (a stored policy name, a GET_DDL argument value, a DML table name resolved at execution time): the caller has already decided it is a plain dotted name with no parse tree to read, so splitting it on '.' is a value-level operation, not a re-derivation of syntax. Consolidating every qualified-name split into this one method keeps that boundary explicit.

  • Method Details

    • of

      public static QualifiedName of(String... parts)
      Build from already-separated identifier parts (e.g. the parse tree's identifier list).
    • parse

      public static QualifiedName parse(String dotted)
      Split a flattened dotted name into its parts — for a name available only as a string. A dot inside double quotes belongs to its part: db.s."a.b" is three parts, the last one a.b, which is how join(java.lang.String...) spells a part that holds a dot. A quoted part without a dot is kept as written, quotes and all, exactly as a plain split always kept it.
    • join

      public static String join(String... parts)
      Join parts into the dotted form parse(java.lang.String) reads back to the same parts: a part holding a dot is quoted (an inner quote doubled), so "a.b" is never mistaken for a schema a and a table b.
    • key

      public static String key(String... parts)
      The row-storage key of a relation: its parts as written, joined as join(java.lang.String...) joins them. Every site that creates, finds, drops or snapshots a relation's rows builds its key here, so they agree for a name that holds a dot too.

      The parts arrive CANONICAL - an unquoted name folded to upper case by the parser, a quoted one verbatim - so the key is not folded again here: two relations whose names differ only in case are two relations, and folding would give them one store between them.

    • size

      public int size()
      Number of parts (1 = name, 2 = schema.name, 3 = db.schema.name).
    • part

      public String part(int i)
      The i-th part (0-based).
    • last

      public String last()
      The last part — the object's own (unqualified) name.
    • parts

      public String[] parts()
      A defensive copy of the parts.
    • toString

      public String toString()
      Overrides:
      toString in class Object