Class CatalogStore
Object
gudusoft.gsqlparser.sqlenv.calcite.CatalogStore
Unified storage abstraction for catalog objects using canonical keys.
This class replaces GSP's legacy triple-index architecture (schemaObjectList + objectIndex + tablesByName) with a clean, type-aware storage system backed by LinkedHashMaps for O(1) lookups.
Key improvements over legacy storage:
- Canonical keys eliminate string suffix hacks ($function, $procedure, etc.)
- Per-type indexes for efficient type-specific lookups
- Vendor-aware case sensitivity via
NameService - Insertion order preservation for compatibility
- Full and partial name resolution support
Thread safety: This class is NOT thread-safe. External synchronization is required if accessed from multiple threads.
- Since:
- 3.2.0.3 (Phase 1)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classImmutable qualified name used as a canonical key. -
Constructor Summary
ConstructorsConstructorDescriptionCatalogStore(EDbVendor vendor) Deprecated.CatalogStore(EDbVendor vendor, IdentifierService identifierService) Creates a new CatalogStore for the specified database vendor with IdentifierService. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Removes all objects from the store.get(String catalog, String schema, String objectName, ESQLDataObjectType type) Finds an object by its fully-qualified name and type.getAll()Returns all objects in insertion order.getByName(String objectName, ESQLDataObjectType type) Finds objects by name only, regardless of catalog/schema.getByType(ESQLDataObjectType type) Finds all objects of a specific type.Returns the name service used by this store.Returns the database vendor associated with this store.put(TSQLSchemaObject object) Adds or updates an object in the store.booleanremove(TSQLSchemaObject object) Removes an object from the store.intsize()Returns the total number of objects in the store.
-
Constructor Details
-
CatalogStore
Deprecated.UseCatalogStore(EDbVendor, IdentifierService)insteadCreates a new CatalogStore for the specified database vendor.- Parameters:
vendor- the database vendor
-
CatalogStore
Creates a new CatalogStore for the specified database vendor with IdentifierService.This is the preferred constructor that uses IdentifierService for proper per-object-type identifier normalization.
- Parameters:
vendor- the database vendoridentifierService- the identifier service for normalization- Since:
- 3.2.0.3 (Phase 3.5)
-
-
Method Details
-
getVendor
Returns the database vendor associated with this store.- Returns:
- the database vendor
-
getNameService
Returns the name service used by this store.- Returns:
- the name service
-
put
Adds or updates an object in the store.The object is indexed by its fully-qualified canonical name and also added to type-specific and name-only indexes for efficient lookups.
- Parameters:
object- the schema object to add- Returns:
- the previous object with the same key, or null if none existed
-
get
public TSQLSchemaObject get(String catalog, String schema, String objectName, ESQLDataObjectType type) Finds an object by its fully-qualified name and type.This is an O(1) lookup using the canonical key index.
- Parameters:
catalog- the catalog name (may be null)schema- the schema name (may be null)objectName- the object name (required)type- the object type- Returns:
- the matching object, or null if not found
-
getByName
Finds objects by name only, regardless of catalog/schema.This is used for partial name resolution when the full path is not specified.
- Parameters:
objectName- the object nametype- the object type (optional - null returns all types)- Returns:
- list of matching objects (may be empty, never null)
-
getByType
Finds all objects of a specific type.- Parameters:
type- the object type- Returns:
- collection of all objects of that type (may be empty, never null)
-
remove
Removes an object from the store.- Parameters:
object- the object to remove- Returns:
- true if the object was removed, false if it was not present
-
size
Returns the total number of objects in the store.- Returns:
- the total count
-
clear
Removes all objects from the store. -
getAll
Returns all objects in insertion order.- Returns:
- collection of all objects (may be empty, never null)
-
CatalogStore(EDbVendor, IdentifierService)instead