Skip to content

Commit af71f54

Browse files
h3n4lclaude
andauthored
feat: add Trino parser to monorepo (#27)
Add ANTLR4-based Trino SQL parser (formerly PrestoSQL) from trino-parser repository into the parser monorepo. Changes: - Add trino/ directory with grammar files (TrinoLexer.g4, TrinoParser.g4) - Add Makefile with build and test targets following the pattern of other parsers - Include 94 SQL test examples covering comprehensive Trino SQL features - Update package name and import paths to github.com/bytebase/parser/trino - Add trino to CI workflow to run tests automatically - All 94 test cases passing Test coverage includes: - DDL statements (CREATE, ALTER, DROP for tables, views, schemas, roles, materialized views) - DML statements (SELECT, INSERT, UPDATE, DELETE, MERGE) - Query features (CTEs, window functions, aggregations, joins, subqueries) - Transaction control (START TRANSACTION, COMMIT, ROLLBACK) - Session management (SET SESSION, RESET SESSION, SET ROLE) - Security (GRANT, REVOKE, DENY) - Administrative commands (SHOW, DESCRIBE, ANALYZE, EXPLAIN) - Trino-specific features (table functions, refresh materialized view, etc.) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <[email protected]>
1 parent e35c065 commit af71f54

File tree

106 files changed

+69975
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+69975
-1
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
id: set-matrix
3535
run: |
3636
# List of all available parsers
37-
ALL_PARSERS="redshift postgresql cql snowflake tsql doris"
37+
ALL_PARSERS="redshift postgresql cql snowflake tsql doris trino"
3838
# Add more parsers here as they are added to the repository
3939
# ALL_PARSERS="redshift mysql postgresql"
4040

trino/Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
all: build test
2+
3+
build:
4+
antlr -Dlanguage=Go -package trino -visitor -o . TrinoLexer.g4 TrinoParser.g4
5+
6+
test:
7+
go test -v -run TestTrinoParser

trino/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Trino grammar for ANTLR4
2+
3+
An ANTLR4 grammar for Trino, formerly known as PrestoSQL.
4+
This grammar is based on the actively maintained [Trino repository](https://github.com/trinodb/trino).
5+
6+
The lexer and parser are referenced from the [offical base antlr file](https://github.com/trinodb/trino/blob/master/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4).
7+
Changes are made to accommodate various language targets as the official one is being developed for Java only.
8+
9+
The examples are extracted from the [offical test file](https://github.com/trinodb/trino/blob/master/core/trino-parser/src/test/java/io/trino/sql/parser/TestSqlParser.java).

0 commit comments

Comments
 (0)