Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/grammar/trino/TrinoSql.g4
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ statement
| KW_TRUNCATE KW_TABLE tableRef # truncateTable
| KW_COMMENT KW_ON KW_TABLE tableRef KW_IS (string | KW_NULL) # commentTable
| KW_COMMENT KW_ON KW_VIEW viewRef KW_IS (string | KW_NULL) # commentView
| KW_COMMENT KW_ON KW_MATERIALIZED KW_VIEW viewRef KW_IS (string | KW_NULL) # commentMaterializedView
| KW_COMMENT KW_ON KW_COLUMN columnRef KW_IS (string | KW_NULL) # commentColumn
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? from=tableRef KW_RENAME KW_TO to=tableNameCreate # renameTable
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName=tableRef KW_ADD KW_COLUMN (KW_IF KW_NOT KW_EXISTS)? column=columnDefinition # addColumn
Expand All @@ -117,16 +118,18 @@ statement
| KW_CREATE (KW_OR KW_REPLACE)? KW_MATERIALIZED KW_VIEW (KW_IF KW_NOT KW_EXISTS)? viewNameCreate (
KW_GRACE KW_PERIOD interval
)? (KW_COMMENT comment=string)? (KW_WITH properties)? KW_AS rootQuery # createMaterializedView
| KW_CREATE (KW_OR KW_REPLACE)? KW_VIEW viewNameCreate (KW_COMMENT comment=string)? (
| KW_CREATE (KW_OR KW_REPLACE)? KW_VIEW (KW_IF KW_NOT KW_EXISTS)? viewNameCreate (KW_COMMENT comment=string)? (
KW_SECURITY (KW_DEFINER | KW_INVOKER)
)? (KW_WITH properties)? KW_AS rootQuery # createView
| KW_REFRESH KW_MATERIALIZED KW_VIEW viewRef # refreshMaterializedView
| KW_DROP KW_MATERIALIZED KW_VIEW (KW_IF KW_EXISTS)? viewRef # dropMaterializedView
| KW_ALTER KW_MATERIALIZED KW_VIEW (KW_IF KW_EXISTS)? from=viewRef KW_RENAME KW_TO to=viewNameCreate # renameMaterializedView
| KW_ALTER KW_MATERIALIZED KW_VIEW viewRef KW_SET KW_PROPERTIES propertyAssignments # setMaterializedViewProperties
| KW_ALTER KW_MATERIALIZED KW_VIEW viewRef KW_SET KW_AUTHORIZATION principal # setMaterializedViewAuthorization
| KW_DROP KW_VIEW (KW_IF KW_EXISTS)? viewRef # dropView
| KW_ALTER KW_VIEW from=viewRef KW_RENAME KW_TO to=viewNameCreate # renameView
| KW_ALTER KW_VIEW from=viewRef KW_SET KW_AUTHORIZATION principal # setViewAuthorization
| KW_ALTER KW_VIEW viewName=viewRef KW_REFRESH # refreshView
| KW_CALL functionName '(' (callArgument (',' callArgument)*)? ')' # call
| KW_CREATE (KW_OR KW_REPLACE)? functionSpecification # createFunction
| KW_DROP KW_FUNCTION (KW_IF KW_EXISTS)? functionName '(' (
Expand Down Expand Up @@ -1608,4 +1611,4 @@ WHITE_SPACE: (' ' | '\t' | '\r' | '\n') -> channel(HIDDEN);
// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer
UNRECOGNIZED: .;
UNRECOGNIZED: .;
2 changes: 1 addition & 1 deletion src/lib/trino/TrinoSql.interp

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions src/lib/trino/TrinoSqlListener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { DeleteContext } from "./TrinoSqlParser.js";
import { TruncateTableContext } from "./TrinoSqlParser.js";
import { CommentTableContext } from "./TrinoSqlParser.js";
import { CommentViewContext } from "./TrinoSqlParser.js";
import { CommentMaterializedViewContext } from "./TrinoSqlParser.js";
import { CommentColumnContext } from "./TrinoSqlParser.js";
import { RenameTableContext } from "./TrinoSqlParser.js";
import { AddColumnContext } from "./TrinoSqlParser.js";
Expand All @@ -49,9 +50,11 @@ import { RefreshMaterializedViewContext } from "./TrinoSqlParser.js";
import { DropMaterializedViewContext } from "./TrinoSqlParser.js";
import { RenameMaterializedViewContext } from "./TrinoSqlParser.js";
import { SetMaterializedViewPropertiesContext } from "./TrinoSqlParser.js";
import { SetMaterializedViewAuthorizationContext } from "./TrinoSqlParser.js";
import { DropViewContext } from "./TrinoSqlParser.js";
import { RenameViewContext } from "./TrinoSqlParser.js";
import { SetViewAuthorizationContext } from "./TrinoSqlParser.js";
import { RefreshViewContext } from "./TrinoSqlParser.js";
import { CallContext } from "./TrinoSqlParser.js";
import { CreateFunctionContext } from "./TrinoSqlParser.js";
import { DropFunctionContext } from "./TrinoSqlParser.js";
Expand Down Expand Up @@ -642,6 +645,18 @@ export class TrinoSqlListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitCommentView?: (ctx: CommentViewContext) => void;
/**
* Enter a parse tree produced by the `commentMaterializedView`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
enterCommentMaterializedView?: (ctx: CommentMaterializedViewContext) => void;
/**
* Exit a parse tree produced by the `commentMaterializedView`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
exitCommentMaterializedView?: (ctx: CommentMaterializedViewContext) => void;
/**
* Enter a parse tree produced by the `commentColumn`
* labeled alternative in `TrinoSqlParser.statement`.
Expand Down Expand Up @@ -846,6 +861,18 @@ export class TrinoSqlListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitSetMaterializedViewProperties?: (ctx: SetMaterializedViewPropertiesContext) => void;
/**
* Enter a parse tree produced by the `setMaterializedViewAuthorization`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
enterSetMaterializedViewAuthorization?: (ctx: SetMaterializedViewAuthorizationContext) => void;
/**
* Exit a parse tree produced by the `setMaterializedViewAuthorization`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
exitSetMaterializedViewAuthorization?: (ctx: SetMaterializedViewAuthorizationContext) => void;
/**
* Enter a parse tree produced by the `dropView`
* labeled alternative in `TrinoSqlParser.statement`.
Expand Down Expand Up @@ -882,6 +909,18 @@ export class TrinoSqlListener implements ParseTreeListener {
* @param ctx the parse tree
*/
exitSetViewAuthorization?: (ctx: SetViewAuthorizationContext) => void;
/**
* Enter a parse tree produced by the `refreshView`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
enterRefreshView?: (ctx: RefreshViewContext) => void;
/**
* Exit a parse tree produced by the `refreshView`
* labeled alternative in `TrinoSqlParser.statement`.
* @param ctx the parse tree
*/
exitRefreshView?: (ctx: RefreshViewContext) => void;
/**
* Enter a parse tree produced by the `call`
* labeled alternative in `TrinoSqlParser.statement`.
Expand Down
Loading