text
flowchart TD
A[User/API Client] --> B(ApiController)
B --> C{AuthService}
C -- Auth Success --> D{Service Router}
D -- SQL --> E[TrinoService]
D -- Iceberg Meta --> F[IcebergService]
D -- Metadata --> G[MetastoreService]
E --> H[Trino JDBC]
F --> I[Iceberg Java API]
G --> J[Hive Metastore]
E & F & G --> K[StorageService]
K --> L[HDFS]
K --> M[S3/S3A]
K --> N[Local/GlusterFS/NFS]
J & I --> O[Iceberg/Hive Metadata]
text
¶ Main Classes
- ApiController: Entry point for REST API.
- AuthService: Handles authentication and SQL permission checks.
- TrinoService: Executes SQL commands on Trino.
- IcebergService: Manages Iceberg table operations and metadata.
- MetastoreService: Interfaces with Hive/Iceberg metastore for metadata.
- StorageService: Unified interface for file storage (HDFS, S3, Local, GlusterFS, NFS).
- User SQL/API request flows through ApiController → AuthService → appropriate Service.
- Data and metadata move between services and storage/metastore as required.
/api/v1/engines/trino/catalogs/{catalog}/formats/{format}/schemas/{schema}/tables/{table}/actions/{sql_type}
Highlights:
- Iceberg support: schema evolution, time travel, upsert/merge, advanced metadata[3][13].
- Storage abstraction: HDFS, S3, S3-compatible, local, GlusterFS, NFS[4].
- User SQL control: via AuthService and UserSQLController.
- Metadata control: via MetastoreService (Hive, Iceberg)[5][9][15].
- Extendable: add more storage or engines as needed.
- Add SQL auditing: Log all queries and metadata changes for compliance.
- Add caching for metadata: To improve performance when accessing Hive/Iceberg metastore[5].
- Support for federated queries: Allow querying across multiple catalogs/sources in Trino[11].
- Role-based access control: Fine-grained permissions for SQL types and metadata operations.
- Async/batch operations: For large data updates/inserts.
- Monitoring/metrics: Integrate with Prometheus/Grafana for system health.
If you need code samples or further breakdowns (e.g., specific class definitions, configuration files), let me know!