For Trino and Presto
Create Trino or Presto metadata and query-history input files that Single Origin can ingest.
Single Origin uses table metadata, column metadata, view definitions, and query logs from Trino or Presto to analyze query behavior and support optimization recommendations.
Required files
Prepare the following files for Single Origin:
| File | Required | Description |
|---|---|---|
tables.parquet | Yes | Table-level metadata from your storage metadata source. |
columns.parquet | Yes | Column-level metadata from your storage metadata source. |
views.parquet | Yes | View definitions and ownership metadata, when available. |
query-historys.json | Yes | Query log records from the Trino or Presto query engine. |
Prerequisites
- Identify the metadata source for the catalogs queried through Trino or Presto.
- Enable or locate query logging for your Trino or Presto environment.
- Prepare a destination where you can write the Parquet and JSON files for upload to Single Origin.
Generate tables.parquet
tables.parquetExport table-level metadata from the storage metadata source used by your Trino or Presto catalogs.
The file should include:
| Field | Type | Description |
|---|---|---|
table_catalog | string | Catalog name. |
table_schema | string | Schema name. |
table_name | string | Table name. |
table_owner | string | Table owner. |
row_count | int64 | Number of rows, when available. |
bytes | int64 | Table size in bytes, when available. |
comment | string | Table comment. |
created | int64 | Creation timestamp. |
last_altered | int64 | Last altered timestamp. |
Expected schema:
message TableItem {
string table_catalog = 1;
string table_schema = 2;
string table_name = 3;
string table_owner = 4;
int64 row_count = 5;
int64 bytes = 6;
string comment = 7;
int64 created = 8;
int64 last_altered = 9;
}Generate columns.parquet
columns.parquetExport column-level metadata from the storage metadata source used by your Trino or Presto catalogs.
The file should include:
| Field | Type | Description |
|---|---|---|
table_catalog | string | Catalog name. |
table_schema | string | Schema name. |
table_name | string | Table name. |
column_name | string | Column name. |
ordinal_position | int32 | Column position in the table. |
is_nullable | string | Whether the column can contain NULL. |
data_type | string | Trino or Presto data type. |
numeric_precision | bytes | Numeric precision, when applicable. |
numeric_scale | bytes | Numeric scale, when applicable. |
datetime_precision | bytes | Datetime precision, when applicable. |
Expected schema:
message schema {
string table_catalog = 1;
string table_schema = 2;
string table_name = 3;
string column_name = 4;
int32 ordinal_position = 5;
string is_nullable = 6;
string data_type = 7;
bytes numeric_precision = 8;
bytes numeric_scale = 9;
bytes datetime_precision = 10;
}Generate views.parquet
views.parquetExport view metadata from the metadata source used by your Trino or Presto catalogs.
The file should include:
| Field | Type | Description |
|---|---|---|
table_catalog | string | Catalog name. |
table_schema | string | Schema name. |
table_name | string | View name. |
view_definition | string | SQL definition for the view. |
table_owner | string | View owner. |
Expected schema:
message schema {
string table_catalog = 1;
string table_schema = 2;
string table_name = 3;
string view_definition = 4;
string table_owner = 5;
}Generate query-historys.json
query-historys.jsonExport query-history records from your Trino or Presto query logs.
The public source page uses records from com.github.trino.querylog.QueryLogListener. Include records with query metadata, query context, user information, query ID, SQL text, query state, server details, and query URI.
Example query text from a query-history record:
select * from hive.dw1.flight where count in (10,264)At minimum, each query-history record should preserve the fields needed to identify:
- The user and query context.
- The Trino or Presto server and environment.
- The query ID.
- The SQL query text.
- The query state.
- The query timestamp.
The filename
query-historys.jsonis intentionally preserved for compatibility with the existing Single Origin import workflow.
Upload the files
After you generate the required files, upload them to Single Origin as input data files.
Before uploading, verify that:
- The files use the expected names.
- The exported columns match the field names and types above.
query-historys.jsoncontains query records from the time window you want Single Origin to analyze.- Query-history records include query IDs, SQL text, user context, query state, and timestamps.
Updated about 18 hours ago