All Known Implementing Classes:
InMemorySymbolTable

public interface SymbolTable
A mutable, namespace-scoped registry of Symbol instances.

The table supports two categories of symbol:

  • Relations — looked up by (namespace, name).
  • Functions — looked up by (namespace, name, parameterSignature), supporting overload resolution.

All name comparisons are case-insensitive.

Lookup order

The single-argument lookup overloads search the "default" namespace first, then the "builtin" namespace. Use the two-argument overloads to target a specific namespace directly.

Registration

register(Symbol) always returns a RegistrationResult; it never throws on conflict. Inspect the result to determine whether the symbol was accepted, replaced with a warning, or rejected.

See Also:
  • Method Details

    • register

      RegistrationResult register(Symbol symbol)
      Attempts to register symbol in the table.

      If a symbol with the same namespace and canonical name (and, for functions, the same parameter signature) already exists, the existing symbol's ShadowPolicy governs the outcome.

      Parameters:
      symbol - the symbol to register; must not be null
      Returns:
      a result describing whether the symbol was accepted, warned, or rejected
    • lookupRelation

      Optional<RelationSymbol> lookupRelation(String name)
      Returns the relation with the given name from the "default" namespace, or — if not found there — from the "builtin" namespace.
      Parameters:
      name - the relation name (case-insensitive)
      Returns:
      the matching relation symbol, or empty if none found
    • lookupRelation

      Optional<RelationSymbol> lookupRelation(String namespace, String name)
      Returns the relation with the given name in the specified namespace.
      Parameters:
      namespace - the target namespace (case-insensitive)
      name - the relation name (case-insensitive)
      Returns:
      the matching relation symbol, or empty if none found
    • resolveRelation

      default Optional<RelationSymbol> resolveRelation(String name)
      Resolves a relation reference that may be either a flat name or a dotted "namespace.relation" reference.

      A dotted name like "relix.relations" or "conn.orders" is first tried as a namespace-qualified lookup (relation relations in namespace relix); if that misses, it falls back to the flat lookupRelation(String) (which also covers connection-table symbols registered under their full dotted name). A name with no dot uses the flat lookup directly.

      This is the single resolution entry point shared by schema inference and physical planning so that a reference resolves identically in both phases.

      Parameters:
      name - the relation reference (flat or dotted; case-insensitive)
      Returns:
      the matching relation symbol, or empty if none found
    • lookupFunction

      List<FunctionSymbol> lookupFunction(String name)
      Returns all overloads of the function with the given name from the "default" namespace, then the "builtin" namespace.
      Parameters:
      name - the function name (case-insensitive)
      Returns:
      all matching function symbols; never null, may be empty
    • resolveFunction

      default List<FunctionSymbol> resolveFunction(String name)
      Resolves a (possibly dotted) table-valued-function reference to its overloads, mirroring resolveRelation(String) for relations.

      A dotted name like "relix.impact" is first tried as a namespace-qualified lookup (function impact in namespace relix); if that misses, it falls back to the flat lookupFunction(String). A name with no dot uses the flat lookup directly. This is the single resolution entry point shared by schema inference, validation, and physical planning, so a table-valued-function call resolves identically in every phase — and lets the shipped introspection stdlib live in the reserved relix namespace (e.g. relix.impact(r)).

      Parameters:
      name - the function reference (flat or dotted; case-insensitive)
      Returns:
      the matching function overloads; never null, may be empty
    • lookupFunction

      List<FunctionSymbol> lookupFunction(String namespace, String name)
      Returns all overloads of the function with the given name in the specified namespace.
      Parameters:
      namespace - the target namespace (case-insensitive)
      name - the function name (case-insensitive)
      Returns:
      all matching function symbols; never null, may be empty
    • lookupFunction

      Optional<FunctionSymbol> lookupFunction(String name, List<ScalarType> paramTypes)
      Returns the unique overload of the function named name whose parameter signature exactly matches paramTypes, searching "default" then "builtin".
      Parameters:
      name - the function name (case-insensitive)
      paramTypes - the ordered list of argument types to match
      Returns:
      the matching overload, or empty if no exact match exists
    • allSymbols

      Collection<Symbol> allSymbols()
      Returns a snapshot of all symbols currently registered in the table, in registration order.
      Returns:
      an unmodifiable collection of all symbols; never null