Skip to content

feat: add Trino parser to monorepo#27

Merged
h3n4l merged 1 commit into
mainfrom
add-trino-parser
Nov 3, 2025
Merged

feat: add Trino parser to monorepo#27
h3n4l merged 1 commit into
mainfrom
add-trino-parser

Conversation

@h3n4l
Copy link
Copy Markdown
Member

@h3n4l h3n4l commented Nov 3, 2025

Summary

Add ANTLR4-based Trino SQL parser (formerly PrestoSQL) from the trino-parser repository into the parser monorepo.

Changes

  • Add trino parser directory with complete parser implementation

    • Grammar files: TrinoLexer.g4, TrinoParser.g4
    • Based on the official Trino repository grammar
    • Makefile with build and test targets (follows existing pattern)
    • README documentation
  • Test coverage: 94 SQL test examples covering comprehensive Trino SQL features

    • DDL statements: CREATE, ALTER, DROP for tables, views, schemas, roles, materialized views
    • DML statements: SELECT, INSERT, UPDATE, DELETE, MERGE
    • Query features:
      • CTEs (WITH clause)
      • Window functions and aggregations
      • All types of JOINs (implicit, lateral, etc.)
      • Subqueries and set operations (UNION, INTERSECT)
    • Transaction control: START TRANSACTION, COMMIT, ROLLBACK
    • Session management: SET SESSION, RESET SESSION, SET ROLE, SET PATH
    • Security: GRANT, REVOKE, DENY for tables and roles
    • Administrative commands: SHOW (catalogs, schemas, tables, columns, functions, grants, roles, stats, session), DESCRIBE, ANALYZE, EXPLAIN
    • Prepared statements: PREPARE, EXECUTE, DEALLOCATE PREPARE
    • Trino-specific features:
      • Table functions and inline routines
      • Materialized view operations (CREATE, DROP, RENAME, REFRESH, SET PROPERTIES)
      • Table property management
      • AT TIME ZONE support
  • Package updates:

    • Updated package name: github.com/bytebase/parser/trino
    • Fixed import paths in test files
    • Generated Go parser files using ANTLR 4
  • CI/CD integration:

    • Added trino to the parser list in .github/workflows/tests.yml
    • Tests will run automatically on changes to trino/ directory

Test Results

All 94 test cases pass successfully:

PASS: TestTrinoParser (94 test cases)

About Trino

Trino (formerly PrestoSQL) is a distributed SQL query engine designed to query large datasets distributed over multiple data sources. It's used by major companies for interactive analytics on big data.

Migration Notes

This moves the parser from the standalone trino-parser repository into the unified parser monorepo alongside PostgreSQL, Redshift, CQL, Snowflake, T-SQL, and Apache Doris parsers.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
@h3n4l h3n4l merged commit af71f54 into main Nov 3, 2025
5 checks passed
@h3n4l h3n4l deleted the add-trino-parser branch November 3, 2025 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant