feat: add presto

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
Kasper Juul Hermansen 2024-08-06 00:02:20 +02:00
parent f345a956c9
commit 026a95790e
Signed by: kjuulh
GPG Key ID: D85D7535F18F35FA
9 changed files with 74 additions and 0 deletions

5
connect-to-presto.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/zsh
set -eu
./docker-exec.sh exec presto presto-cli --server localhost:8080 --execute 'select count(*) from iceberg.demo_db.demo_table;'

View File

@ -4,5 +4,6 @@ docker compose \
-f templates/docker-compose.rising-wave.yaml \
-f templates/docker-compose.iceberg.yaml \
-f templates/docker-compose.clickhouse.yaml \
-f templates/docker-compose.trino.yaml \
-f templates/docker-compose.yaml \
$@

13
prepare.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/zsh
set -eu
psql -h 0.0.0.0 -p 4566 -d dev -U root -f templates/create_sources.sql || true
psql -h 0.0.0.0 -p 4566 -d dev -U root -f templates/create_mvs.sql || true
psql -h 0.0.0.0 -p 4566 -d dev -U root -f templates/create_create_iceberg_sink.sql || true
psql -h 0.0.0.0 -p 4566 -d dev -U root -f templates/create_create_clickhouse_sink.sql || true
./docker-exec.sh exec spark bash /spark-script/run_sql.sh create-table
./docker-exec.sh exec spark bash /spark-script/run_sql.sh query-table

View File

@ -29,6 +29,7 @@ services:
- SPARK_MASTER_URL=spark://spark:7077
- SPARK_WORKER_MEMORY=1G
- SPARK_WORKER_CORES=1
configs:
run_sql:
content: |

View File

@ -0,0 +1,20 @@
services:
presto:
build:
context: .
dockerfile: presto.Dockerfile
container_name: presto
# trino:
# image: trinodb/trino
# ports:
# - 18080:8080
# configs:
# - source: iceberg_properties
# target: /etc/catalog/iceberg.properties
# configs:
# iceberg_properties:
# content: |
# connector.name=iceberg
# hive.metastore.uri=thrift://192.0.2.3:9083

View File

@ -0,0 +1,22 @@
<configuration>
<property>
<name>presto.s3.endpoint</name>
<value>http://minio-0:9301</value>
</property>
<property>
<name>presto.s3.path-style-access</name>
<value>true</value>
</property>
<property>
<name>presto.s3.access-key</name>
<value>hummockadmin</value>
</property>
<property>
<name>presto.s3.secret-key</name>
<value>hummockadmin</value>
</property>
<property>
<name>fs.s3a.impl</name>
<value>com.facebook.presto.hive.s3.PrestoS3FileSystem</value>
</property>
</configuration>

View File

@ -0,0 +1,5 @@
connector.name=iceberg
iceberg.catalog.type=hadoop
iceberg.catalog.warehouse=s3a://hummock001/iceberg-data
iceberg.hadoop.config.resources=/etc/iceberg/conf/hadoop-catalog.xml
hive.config.resources=/etc/iceberg/conf/hadoop-catalog.xml

2
templates/log.properties Normal file
View File

@ -0,0 +1,2 @@
com.facebook.presto=DEBUG
org.apache.hadoop=DEBUG

View File

@ -0,0 +1,5 @@
FROM prestodb/presto
COPY ./iceberg.properties /opt/presto-server/etc/catalog
COPY ./log.properties /opt/presto-server/etc
COPY ./hadoop-catalog.xml /etc/iceberg/conf/hadoop-catalog.xml