Skip to content

Commit

Permalink
fix: add presto-trino demo to ci pipeline (#14477)
Browse files Browse the repository at this point in the history
  • Loading branch information
neverchanje authored Jan 15, 2024
1 parent c9e3e92 commit 6460a5b
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ci/scripts/gen-integration-test-yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
'starrocks-sink': ['json'],
'deltalake-sink': ['json'],
'pinot-sink': ['json'],
'presto-trino': ['json'],
'client-library': ['none'],

}

def gen_pipeline_steps():
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/presto-trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

1. Start the cluster with `docker compose up -d` command.
The command will start a RisingWave cluster together with a integrated trino and presto instance.

2. Connect the RisingWave frontend via the psql client. Create and insert data into the RisingWave table.
```shell
psql -h localhost -p 4566 -d dev -U root
Expand All @@ -16,6 +17,7 @@ INSERT 0 1
dev=> flush;
FLUSH
```

3. Query RisingWave from presto or trino
```shell
# Start trino client
Expand Down
26 changes: 26 additions & 0 deletions integration_tests/presto-trino/create_source.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
CREATE TABLE IF NOT EXISTS data_types (
id BIGINT PRIMARY KEY,
varchar_column VARCHAR,
text_column TEXT,
integer_column INTEGER,
smallint_column SMALLINT,
bigint_column BIGINT,
-- decimal_column DECIMAL, prestodb cannot handle postgres's decimal when the precision is unspecified, as the precision range exceeds its maximum precision.
real_column REAL,
double_column DOUBLE PRECISION,
boolean_column BOOLEAN,
date_column DATE,
time_column TIME,
timestamp_column TIMESTAMP,
timestamptz_column TIMESTAMPTZ,
jsonb_column JSONB,
bytea_column BYTEA
);

INSERT INTO data_types (id, varchar_column, text_column, integer_column, smallint_column, bigint_column, real_column, double_column, boolean_column, date_column, time_column, timestamp_column, timestamptz_column, jsonb_column, bytea_column)
VALUES
(1, 'Varchar value 1', 'Text value 1', 123, 456, 789, 12.34, 90.12, TRUE, '2023-05-22', '12:34:56', '2023-05-22 12:34:56', '2023-05-22T12:34:56Z', '{"key": "value"}', E'\\xDEADBEEF'),
(2, 'Varchar value 2', 'Text value 2', 234, 567, 890, 23.45, 01.23, FALSE, '2023-05-23', '23:45:01', '2023-05-23 23:45:01', '2023-05-23T23:45:01Z', '{"key": "value2"}', E'\\xFEEDBEEF'),
(3, 'Varchar value 3', 'Text value 3', 345, 678, 901, 34.56, 12.34, TRUE, '2023-05-24', '12:34:56', '2023-05-24 12:34:56', '2023-05-24T12:34:56Z', '{"key": "value3"}', E'\\xCAFEBABE'),
(4, 'Varchar value 4', 'Text value 4', 456, 789, 012, 45.67, 23.45, FALSE, '2023-05-25', '23:45:01', '2023-05-25 23:45:01', '2023-05-25T23:45:01Z', '{"key": "value4"}', E'\\xBABEC0DE'),
(5, 'Varchar value 5', 'Text value 5', 567, 890, 123, 56.78, 34.56, TRUE, '2023-05-26', '12:34:56', '2023-05-26 12:34:56', '2023-05-26T12:34:56Z', '{"key": "value5"}', E'\\xDEADBABE');
1 change: 1 addition & 0 deletions integration_tests/presto-trino/data_check
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
data_types
6 changes: 4 additions & 2 deletions integration_tests/presto-trino/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ services:
profiles: [ "client" ]
entrypoint: [ "trino", "--server", "trino:8080", "--catalog", "risingwave", "--schema", "public" ]
presto:
image: ahanaio/prestodb-sandbox
image: prestodb/presto:0.284
container_name: presto
volumes:
- ./etc/risingwave.properties:/opt/presto-server/etc/catalog/risingwave.properties
- ./etc/config.properties:/opt/presto-server/etc/config.properties
- ./etc/jvm.config:/opt/presto-server/etc/jvm.config
ports:
- "8080:8080"
presto-client:
image: ahanaio/prestodb-sandbox
image: prestodb/presto:0.284
profiles: [ "client" ]
entrypoint: [ "presto-cli", "--server", "presto:8080", "--catalog", "risingwave", "--schema", "public" ]
volumes:
Expand Down
7 changes: 7 additions & 0 deletions integration_tests/presto-trino/etc/config.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
coordinator=true
node-scheduler.include-coordinator=true
http-server.http.port=8080
query.max-memory=5GB
query.max-memory-per-node=1GB
discovery-server.enabled=true
discovery.uri=http://0.0.0.0:8080
9 changes: 9 additions & 0 deletions integration_tests/presto-trino/etc/jvm.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-server
-Xmx16G
-XX:+UseG1GC
-XX:G1HeapRegionSize=32M
-XX:+UseGCOverheadLimit
-XX:+ExplicitGCInvokesConcurrent
-XX:+HeapDumpOnOutOfMemoryError
-XX:+ExitOnOutOfMemoryError
-Djdk.attach.allowAttachSelf=true
16 changes: 16 additions & 0 deletions integration_tests/presto-trino/sink_check.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import subprocess
import sys

failed_cases = []
for client_image in ['presto-client', 'trino-client']:
output = subprocess.check_output(
["docker", "compose", "run", client_image,
"--execute", "select * from data_types"],
)
rows_cnt = len(output.splitlines())
if rows_cnt < 1:
failed_cases.append(client_image)

if len(failed_cases) != 0:
print(f"Data check failed for case {failed_cases}")
sys.exit(1)

0 comments on commit 6460a5b

Please sign in to comment.