Package dev.frostlake.executor.commands
Class AlterCommandHandler
java.lang.Object
dev.frostlake.executor.commands.AlterCommandHandler
- All Implemented Interfaces:
CommandHandler
Handles
ALTER <object-type> … statements for DATABASE / SCHEMA / MASKING & ROW ACCESS
POLICY / TABLE / VIEW / STREAM / TASK / PIPE / WAREHOUSE / STAGE / USER / ROLE / SESSION / TAG,
extracted verbatim from SQLCommandVisitor.visitAlterStatement(dev.frostlake.parser.FrostlakeParser.AlterStatementContext). Leaf object types the visitor
historically routed to the DDL side (FILE FORMAT / FUNCTION / PROCEDURE / DYNAMIC TABLE /
MATERIALIZED VIEW / SEQUENCE) are still forwarded to DDLCommandHandler.handleAlterStatement(dev.frostlake.parser.FrostlakeParser.AlterStatementContext).
Parse-text extraction (getText, extractStringLiteral, getOriginalText) and the
shared engine helpers (parseDataType, parseLiteral, resolveCurrentSchema) are
reached through the visitor back-reference so their exact original behavior is preserved; the
task scheduler is read live via SQLCommandVisitor.getTaskScheduler() (it is wired onto the
visitor post-construction).-
Constructor Summary
ConstructorsConstructorDescriptionAlterCommandHandler(Catalog catalog, QueryExecutor queryExecutor, SQLCommandVisitor visitor, DDLCommandHandler ddlHandler) Wires the handler to the engine collaborators every ALTER branch needs. -
Method Summary
Modifier and TypeMethodDescriptionGet catalog instanceGet query executor instanceDispatches anALTER <object-type> …statement on the object-type keyword in the parse tree and applies the requested action (RENAME / SET / UNSET / COMMENT / SUSPEND / RESUME / column and constraint changes, …) to the catalog object, after the owner/ALTER-privilege check.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.frostlake.executor.commands.CommandHandler
extractComment, extractComment, getText, getText, qualifiedNameParts
-
Constructor Details
-
AlterCommandHandler
public AlterCommandHandler(Catalog catalog, QueryExecutor queryExecutor, SQLCommandVisitor visitor, DDLCommandHandler ddlHandler) Wires the handler to the engine collaborators every ALTER branch needs.- Parameters:
catalog- the metastore catalog whose objects the ALTER actions mutatequeryExecutor- the engine's query executor, for session state and security checksvisitor- back-reference to the visitor's shared parse-text and type helpers (the task scheduler is read through it live, as it is wired on post-construction)ddlHandler- the DDL-side handler that still owns the forwarded leaf object types
-
-
Method Details
-
getCatalog
Description copied from interface:CommandHandlerGet catalog instance- Specified by:
getCatalogin interfaceCommandHandler- Returns:
- the engine's metastore catalog, holding the objects this handler reads and mutates
-
getQueryExecutor
Description copied from interface:CommandHandlerGet query executor instance- Specified by:
getQueryExecutorin interfaceCommandHandler- Returns:
- the engine's query executor, for handlers that run nested queries or need session state
-
handle
Dispatches anALTER <object-type> …statement on the object-type keyword in the parse tree and applies the requested action (RENAME / SET / UNSET / COMMENT / SUSPEND / RESUME / column and constraint changes, …) to the catalog object, after the owner/ALTER-privilege check.IF EXISTSturns a missing target into a silent success instead of an error; leaf object types the visitor historically routed to the DDL side are forwarded toDDLCommandHandler.handleAlterStatement(dev.frostlake.parser.FrostlakeParser.AlterStatementContext).- Parameters:
ctx- the ALTER statement's parse tree- Returns:
- null for the branches handled here (the executor renders the standard status result), or the DDL handler's result for a forwarded object type
-