tree: edd057e32cdfcccd45f07bc75a4267096c7bd267
  1. scripts/
  2. src/
  3. trino/
  4. demo.sh
  5. docker-compose.yml
  6. pom.xml
  7. README.md
platforms-setup-guides/trino-setup/README.md

Trino Local Setup

Local Trino environment backed by an Iceberg data lake, completely containerised.

The current validation has three parts:

  1. Build the Wayang Trino platform and run the shared JDBC SQL-generation tests.
  2. Run the Wayang Trino operator tests against the live local stack.
  3. Run standalone JDBC integration tests against the local Trino, Iceberg, and MinIO stack.

Run the commands below from the repository root. Java 17 and Docker with Docker Compose are required; Maven is provided by the repository wrapper.

The pure Trino platform branch is named wayang-trino:

git checkout wayang-trino

Command Conventions

Use the bash blocks on macOS/Linux terminals. Use the powershell blocks on Windows PowerShell from the repository root. Docker Compose commands are the same on both platforms.

Stack

ComponentImagePortRole
Trinotrinodb/trino:4358080SQL query engine
Hive Metastorenaushadh/hive-metastore:latest9083Iceberg table catalog (Thrift)
PostgreSQLpostgres:15-alpine5432HMS metadata backing store
MinIOminio/minio:latest9000 / 9001S3-compatible object storage

HMS is the battle-tested Iceberg catalog for Trino. Parquet data files are written by Trino directly to MinIO; HMS only stores schema/table metadata.

Directory Layout

platforms-setup-guides/
`-- trino-setup/
    |-- docker-compose.yml          # Full stack definition
    |-- demo.sh                     # End-to-end Trino + Wayang walkthrough
    |-- trino/
    |   |-- config.properties       # Trino node config
    |   `-- catalog/
    |       |-- iceberg.properties  # Iceberg via HMS + MinIO
    |       `-- tpch.properties     # Built-in TPC-H (no storage needed)
    |-- scripts/
    |   |-- init.sql                # Creates iceberg.sales.orders + sample rows
    |   `-- run-init.sh             # Helper: waits for Trino then runs init.sql
    |-- pom.xml                     # Standalone Maven project (Java 17)
    `-- src/test/java/.../
        `-- TrinoIntegrationTest.java   # JUnit 5 integration tests

1. Test the Wayang Trino Platform

Build the Trino platform and its required modules:

./mvnw -Pskip-prerequisite-check -pl wayang-platforms/wayang-trino -am -DskipTests -Drat.skip=true test

On PowerShell:

.\mvnw.cmd --% -Pskip-prerequisite-check -pl wayang-platforms/wayang-trino -am -DskipTests -Drat.skip=true test

Then run the shared JDBC SQL-generation tests:

./mvnw -Pskip-prerequisite-check -pl wayang-platforms/wayang-jdbc-template -am -Dtest=JdbcExecutorTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Drat.skip=true test

On PowerShell:

.\mvnw.cmd --% -Pskip-prerequisite-check -pl wayang-platforms/wayang-jdbc-template -am -Dtest=JdbcExecutorTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Drat.skip=true test

Expected result:

Wayang Platform Trino ... SUCCESS
Tests run: 4, Failures: 0, Errors: 0, Skipped: 0

2. Test Against the Local Trino Stack

1. Start the stack

docker compose -f platforms-setup-guides/trino-setup/docker-compose.yml up -d

Wait ~30 seconds for all services to become healthy. Check with:

docker compose -f platforms-setup-guides/trino-setup/docker-compose.yml ps
# or watch the Trino UI at http://localhost:8080

2. Run the Wayang Trino operator tests

TrinoOperatorsIT exercises the Wayang Trino implementation against the live Trino stack. It checks TableSource, Filter, Projection, Join, GlobalReduce, ReduceBy, Sort, and TableSink, and confirms that the expected SQL reached Trino. The standalone join test now runs a full Wayang plan and normalizes both possible join result shapes before collecting records: logical joins can produce Tuple2<Record, Record>, while pushed-down JDBC joins can return a flat Record.

The suite is self-contained: it creates iceberg.wayang_it, scales its test data to 120,000 rows so the optimizer selects SQL pushdown, and drops its test tables afterward. It does not require scripts/init.sql. The suite also contains five JavaPlanBuilder readTable combination tests that cover filter, projection, global reduce, reduce-by plus sort, table sink, and join through the public API.

./mvnw -Pskip-prerequisite-check -pl wayang-platforms/wayang-trino -am \
  -Dtest=TrinoOperatorsIT -Dsurefire.failIfNoSpecifiedTests=false \
  -DfailIfNoTests=false -Drat.skip=true -Dlicense.skip=true test

On PowerShell:

.\mvnw.cmd --% -Pskip-prerequisite-check -pl wayang-platforms/wayang-trino -am -Dtest=TrinoOperatorsIT -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Drat.skip=true -Dlicense.skip=true test

Expected result:

Tests run: 13, Failures: 0, Errors: 0, Skipped: 0

Verified on June 18, 2026 against the local Docker stack with the full-plan join test and all five JavaPlanBuilder combination tests enabled.

If Trino is unreachable, these tests are skipped instead of failed. A result with skipped tests does not confirm that the operators work.

3. Load sample Iceberg data

bash platforms-setup-guides/trino-setup/scripts/run-init.sh

On PowerShell:

Get-Content -Raw platforms-setup-guides/trino-setup/scripts/init.sql | docker exec -i trino trino --server http://localhost:8080 --user admin

This creates the schema iceberg.sales and inserts 20 sample orders into iceberg.sales.orders (Parquet files on MinIO).

4. Run the walkthrough demo

The optional demo script starts the local Trino/Iceberg stack, seeds iceberg.sales.orders, shows direct Trino CLI queries, and then runs org.apache.wayang.trino.TrinoDemo to demonstrate Wayang filter and projection pushdown through the Trino platform.

bash platforms-setup-guides/trino-setup/demo.sh

Set WAYANG_DEMO_AUTO=true to skip the interactive pauses.

5. Run the standalone stack integration tests

./mvnw -f platforms-setup-guides/trino-setup/pom.xml -Pintegration -Dtest=TrinoIntegrationTest test

On PowerShell:

.\mvnw.cmd --% -f platforms-setup-guides/trino-setup/pom.xml -Pintegration -Dtest=TrinoIntegrationTest test

Tests are skipped by default (no -Pintegration) to avoid requiring Docker in CI. These tests validate the stack and direct JDBC queries independently of the Wayang operator implementation.

Expected result:

Tests run: 10, Failures: 0, Errors: 0, Skipped: 0
BUILD SUCCESS

6. Manual exploration

Open the Trino UI: http://localhost:8080

Or connect via the Trino CLI inside the container:

docker exec -it trino trino --catalog iceberg --schema sales
-- TPC-H built-in data (no init.sql needed)
SELECT * FROM tpch.tiny.orders LIMIT 5;

-- Iceberg table
SELECT region, SUM(amount) FROM iceberg.sales.orders GROUP BY region;

-- Iceberg file metadata
SELECT * FROM iceberg.sales."orders$files";

-- Iceberg history
SELECT * FROM iceberg.sales."orders$history";

MinIO console: http://localhost:9001 (login: minioadmin / minioadmin) Look for Parquet files under warehouse/sales/orders/.

7. Tear down

docker compose -f platforms-setup-guides/trino-setup/docker-compose.yml down -v

The -v option removes volumes and clears the local MinIO and PostgreSQL data.

Test Coverage

Wayang operator integration tests

TestWhat it checks
tableSourceFull table scan through TrinoTableSource
filterWayang FilterOperator and SQL WHERE pushdown
projectionColumn projection pushed into the Trino query
joinFull Wayang join plan with normalization before the collecting sink
globalReduceGlobal aggregation such as SUM
reduceByGrouped aggregation and SQL GROUP BY
sortWayang sort and SQL ORDER BY
tableSinkFiltered result written with CREATE TABLE AS
javaPlanBuilderReadTableFilterProjectionreadTable -> filter -> projection -> collect
javaPlanBuilderReadTableFilterGlobalReducereadTable -> filter -> globalReduce -> collect
javaPlanBuilderReadTableReduceBySortreadTable -> reduceByKey -> sort -> collect
javaPlanBuilderReadTableFilterProjectionTableSinkreadTable -> filter -> projection -> writeTable
javaPlanBuilderReadTableJoinreadTable + readTable -> join -> collect

Standalone stack integration tests

TestWhat it checks
testConnectivitySELECT 1, JDBC connection works
testTpchConnectorTPC-H built-in connector, no storage needed
testTpchTopOrdersORDER BY + LIMIT on TPC-H
testIcebergSchemaVisibleSchema created by init.sql is visible
testIcebergSelectAllFull table scan, 20 rows
testIcebergFilterByRegionWHERE pushdown on string column
testIcebergAggregateGROUP BY + SUM aggregation
testIcebergFilterByAmountWHERE pushdown on double column
testIcebergProjectionSELECT subset of columns
testIcebergFilesMetadata$files system table, confirms Parquet on MinIO

Environment Variables

Override defaults if running Trino on a different host/port:

TRINO_HOST=my-trino-host TRINO_PORT=8080 ./mvnw -f platforms-setup-guides/trino-setup/pom.xml -Pintegration -Dtest=TrinoIntegrationTest test

On PowerShell:

$env:TRINO_HOST="my-trino-host"
$env:TRINO_PORT="8080"
.\mvnw.cmd --% -f platforms-setup-guides/trino-setup/pom.xml -Pintegration -Dtest=TrinoIntegrationTest test
Remove-Item Env:TRINO_HOST, Env:TRINO_PORT