From f298cba340b00d8f35e199c0b79ce9117b88bac6 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Tue, 22 Nov 2022 18:40:19 +0800
Subject: [PATCH 01/18] spark benchmark optimize
---
docker/benchmark/.env | 3 +-
docker/benchmark/build-image.sh | 8 +-
docker/benchmark/docker-compose.yml | 13 +-
.../benchmark-config/spark_arctic_config.xml | 132 ++++++++
.../benchmark-config/spark_hudi_config.xml | 132 ++++++++
.../benchmark-config/spark_iceberg_config.xml | 132 ++++++++
.../images/benchmark-spark.Dockerfile | 48 +--
.../benchmark/images/scripts/arctic-init.sql | 281 ------------------
.../scripts/benchmark-ams-entrypoint.sh | 3 -
.../scripts/benchmark-spark-entrypoint.sh | 15 +
.../images/spark-config/spark-defaults.conf | 1 +
11 files changed, 460 insertions(+), 308 deletions(-)
create mode 100644 docker/benchmark/images/benchmark-config/spark_arctic_config.xml
create mode 100644 docker/benchmark/images/benchmark-config/spark_hudi_config.xml
create mode 100644 docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
delete mode 100644 docker/benchmark/images/scripts/arctic-init.sql
delete mode 100644 docker/benchmark/images/scripts/benchmark-ams-entrypoint.sh
create mode 100644 docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
diff --git a/docker/benchmark/.env b/docker/benchmark/.env
index 4e0ea639..610070e5 100644
--- a/docker/benchmark/.env
+++ b/docker/benchmark/.env
@@ -27,5 +27,6 @@ MYSQL_VERSION=8.0.30
SCALA_BINARY_VERSION=2.12
SPARK_VERSION=3.1.3
SPARK_BINARY_VERSION=3.1
-SPARK_HADOOP_VERSION=3.2.0
ZOOKEEPER_VERSION=3.6.3
+
+tpcc_name_prefix=arctic.
diff --git a/docker/benchmark/build-image.sh b/docker/benchmark/build-image.sh
index f633b0c4..7c7a94c2 100755
--- a/docker/benchmark/build-image.sh
+++ b/docker/benchmark/build-image.sh
@@ -84,7 +84,13 @@ ${BUILD_CMD} \
"${SELF_DIR}/images" $@
${BUILD_CMD} \
- --build-arg BENCHMARK_VERSION=${BENCHMARK_VERSION} \
+ --build-arg APACHE_MIRROR=${APACHE_MIRROR} \
+ --build-arg MAVEN_MIRROR=${MAVEN_MIRROR} \
+ --build-arg SPARK_VERSION=${SPARK_VERSION} \
+ --build-arg SPARK_BINARY_VERSION=${SPARK_BINARY_VERSION} \
+ --build-arg ARCTIC_VERSION=${ARCTIC_VERSION} \
+ --build-arg ARCTIC_RELEASE=${ARCTIC_RELEASE} \
+ --build-arg SCALA_BINARY_VERSION=${SCALA_BINARY_VERSION} \
--file "${SELF_DIR}/images/benchmark-spark.Dockerfile" \
--tag arctic163/benchmark-spark:${BENCHMARK_VERSION} \
"${SELF_DIR}/images" $@
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index f7c4dadd..a25eb11e 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -16,7 +16,6 @@ services:
volumes:
- ./images/scripts/hive-schema-2.3.0.mysql.sql:/docker-entrypoint-initdb.d/hive-schema-2.3.0.mysql.sql
- ./images/scripts/hive-txn-schema-2.3.0.mysql.sql:/docker-entrypoint-initdb.d/hive-txn-schema-2.3.0.mysql.sql
- - ./images/scripts/arctic-init.sql:/docker-entrypoint-initdb.d/arctic-init.sql
metastore:
image: arctic163/benchmark-metastore:${BENCHMARK_VERSION}
@@ -77,12 +76,14 @@ services:
image: arctic163/benchmark-spark:${BENCHMARK_VERSION}
container_name: spark
hostname: spark
- command: ["bash","-c","./sbin/start-thriftserver.sh && tail -f /dev/null"]
+ environment:
+ MYSQL_USER: root
+ MYSQL_PASSWORD: password
volumes:
- ./hive:/tmp/hive/warehouse
- ./arctic:/tmp/arctic/warehouse
- - ./images/hive-config/hive-site.xml:/usr/local/arctic_spark/spark-3.1.3-bin-hadoop2.7/conf/hive-site.xml
- - ./images/spark-config/spark-defaults.conf:/usr/local/arctic_spark/spark-3.1.3-bin-hadoop2.7/conf/spark-defaults.conf
+ - ./images/hive-config/hive-site.xml:/opt/spark/conf/hive-site.xml
+ - ./images/spark-config/spark-defaults.conf:/opt/spark/conf/spark-defaults.conf
ports:
- 10000:10000
depends_on:
@@ -98,9 +99,13 @@ services:
- ./images/benchmark-config/presto_hudi_config.xml:/usr/lib/lakehouse-benchmark/config/trino/presto_hudi_config.xml
- ./images/benchmark-config/trino_arctic_config.xml:/usr/lib/lakehouse-benchmark/config/trino/trino_arctic_config.xml
- ./images/benchmark-config/trino_iceberg_config.xml:/usr/lib/lakehouse-benchmark/config/trino/trino_iceberg_config.xml
+ - ./images/benchmark-config/spark_arctic_config.xml:/usr/lib/lakehouse-benchmark/config/spark/spark_arctic_config.xml
+ - ./images/benchmark-config/spark_hudi_config.xml:/usr/lib/lakehouse-benchmark/config/spark/spark_hudi_config.xml
+ - ./images/benchmark-config/spark_iceberg_config.xml:/usr/lib/lakehouse-benchmark/config/spark/spark_iceberg_config.xml
depends_on:
- trino
- mysql
+ - spark
tty: true
stdin_open: true
diff --git a/docker/benchmark/images/benchmark-config/spark_arctic_config.xml b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
new file mode 100644
index 00000000..55117f26
--- /dev/null
+++ b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
@@ -0,0 +1,132 @@
+
+
+
+
+ HIVE
+ org.apache.hive.jdbc.HiveDriver
+ jdbc:hive2://spark:10000/local_catalog
+ hdfs
+
+ TRANSACTION_READ_UNCOMMITTED
+ 128
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 200
+ disabled
+ unlimited
+
+ 45,43,4,4,4
+ 3, 2, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+
+
+
+
+
+
+
+
+ Q1
+
+
+ Q2
+
+
+ Q3
+
+
+ Q4
+
+
+ Q5
+
+
+ Q6
+
+
+ Q7
+
+
+ Q8
+
+
+ Q9
+
+
+ Q10
+
+
+ Q11
+
+
+ Q12
+
+
+ Q13
+
+
+ Q14
+
+
+ Q15
+
+
+ Q17
+
+
+ Q18
+
+
+ Q19
+
+
+ Q20
+
+
+ Q21
+
+
+ Q22
+
+
+
+
+
+
+ NewOrder
+
+
+ Payment
+
+
+ OrderStatus
+
+
+ Delivery
+
+
+ StockLevel
+
+
+
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-config/spark_hudi_config.xml b/docker/benchmark/images/benchmark-config/spark_hudi_config.xml
new file mode 100644
index 00000000..3d23b5c5
--- /dev/null
+++ b/docker/benchmark/images/benchmark-config/spark_hudi_config.xml
@@ -0,0 +1,132 @@
+
+
+
+
+ HIVE
+ org.apache.hive.jdbc.HiveDriver
+ jdbc:hive2://spark:10000/hudi
+ hdfs
+
+ TRANSACTION_READ_UNCOMMITTED
+ 128
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 200
+ disabled
+ unlimited
+
+ 45,43,4,4,4
+ 3, 2, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+
+
+
+
+
+
+
+
+ Q1
+
+
+ Q2
+
+
+ Q3
+
+
+ Q4
+
+
+ Q5
+
+
+ Q6
+
+
+ Q7
+
+
+ Q8
+
+
+ Q9
+
+
+ Q10
+
+
+ Q11
+
+
+ Q12
+
+
+ Q13
+
+
+ Q14
+
+
+ Q15
+
+
+ Q17
+
+
+ Q18
+
+
+ Q19
+
+
+ Q20
+
+
+ Q21
+
+
+ Q22
+
+
+
+
+
+
+ NewOrder
+
+
+ Payment
+
+
+ OrderStatus
+
+
+ Delivery
+
+
+ StockLevel
+
+
+
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
new file mode 100644
index 00000000..2457ce3d
--- /dev/null
+++ b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
@@ -0,0 +1,132 @@
+
+
+
+
+ HIVE
+ org.apache.hive.jdbc.HiveDriver
+ jdbc:hive2://spark:10000/iceberg_catalog
+ hdfs
+
+ TRANSACTION_READ_UNCOMMITTED
+ 128
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 200
+ disabled
+ unlimited
+
+ 45,43,4,4,4
+ 3, 2, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+
+
+
+
+
+
+
+
+ Q1
+
+
+ Q2
+
+
+ Q3
+
+
+ Q4
+
+
+ Q5
+
+
+ Q6
+
+
+ Q7
+
+
+ Q8
+
+
+ Q9
+
+
+ Q10
+
+
+ Q11
+
+
+ Q12
+
+
+ Q13
+
+
+ Q14
+
+
+ Q15
+
+
+ Q17
+
+
+ Q18
+
+
+ Q19
+
+
+ Q20
+
+
+ Q21
+
+
+ Q22
+
+
+
+
+
+
+ NewOrder
+
+
+ Payment
+
+
+ OrderStatus
+
+
+ Delivery
+
+
+ StockLevel
+
+
+
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-spark.Dockerfile b/docker/benchmark/images/benchmark-spark.Dockerfile
index f59a89ba..b91eb9d4 100644
--- a/docker/benchmark/images/benchmark-spark.Dockerfile
+++ b/docker/benchmark/images/benchmark-spark.Dockerfile
@@ -1,27 +1,39 @@
FROM openjdk:8u332-jdk
-WORKDIR /usr/local/arctic_spark
-
-RUN apt update \
- && apt-get install -y vim \
- && apt-get install -y net-tools \
- && apt-get install -y telnet
-
-RUN wget https://dlcdn.apache.org/spark/spark-3.1.3/spark-3.1.3-bin-hadoop2.7.tgz && \
- tar -zxvf spark-3.1.3-bin-hadoop2.7.tgz && \
- rm -rf spark-3.1.3-bin-hadoop2.7.tgz
-
-ENV SPARK_HOME=/usr/local/arctic_spark/spark-3.1.3-bin-hadoop2.7 \
- PATH=${PATH}:${SPARK_HOME}/bin
-
-RUN wget https://github.com/NetEase/arctic/releases/download/v0.3.2-rc1/arctic-spark_3.1-runtime-0.3.2.jar -P ${SPARK_HOME}/jars && \
- wget https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-spark-runtime-3.1_2.12/1.0.0/iceberg-spark-runtime-3.1_2.12-1.0.0.jar -P ${SPARK_HOME}/jars && \
- wget https://repo1.maven.org/maven2/org/apache/hudi/hudi-spark3.1-bundle_2.12/0.12.1/hudi-spark3.1-bundle_2.12-0.12.1.jar -P ${SPARK_HOME}/jars && \
- wget https://repo1.maven.org/maven2/io/delta/delta-core_2.12/1.0.0/delta-core_2.12-1.0.0.jar -P ${SPARK_HOME}/jars
+ARG APACHE_MIRROR
+ARG MAVEN_MIRROR
+ARG SPARK_VERSION
+ARG SPARK_BINARY_VERSION
+ARG ARCTIC_VERSION
+ARG ARCTIC_RELEASE
+ARG SCALA_BINARY_VERSION
+
+ENV SPARK_HOME=/opt/spark
+
+RUN apt update && \
+ apt-get install -y vim && \
+ apt-get install -y net-tools && \
+ apt-get install -y telnet && \
+ apt-get install -y default-mysql-client && \
+ apt-get clean
+
+RUN wget ${APACHE_MIRROR}/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop3.2.tgz && \
+ tar -xzf spark-${SPARK_VERSION}-bin-hadoop3.2.tgz -C /opt && \
+ ln -s /opt/spark-${SPARK_VERSION}-bin-hadoop3.2 ${SPARK_HOME} && \
+ rm spark-${SPARK_VERSION}-bin-hadoop3.2.tgz
+
+RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/arctic-spark_3.1-runtime-${ARCTIC_VERSION}.jar -P ${SPARK_HOME}/jars && \
+ wget https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}/1.0.0/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}-1.0.0.jar -P ${SPARK_HOME}/jars && \
+ wget https://repo1.maven.org/maven2/org/apache/hudi/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}/0.12.1/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}-0.12.1.jar -P ${SPARK_HOME}/jars && \
+ wget https://repo1.maven.org/maven2/io/delta/delta-core_${SCALA_BINARY_VERSION}/1.0.0/delta-core_${SCALA_BINARY_VERSION}-1.0.0.jar -P ${SPARK_HOME}/jars
RUN mkdir -p -m 777 /tmp/hive
RUN mkdir -p -m 777 /tmp/arctic
WORKDIR ${SPARK_HOME}
+COPY scripts/benchmark-spark-entrypoint.sh ${SPARK_HOME}
+RUN chmod a+x ${SPARK_HOME}/benchmark-spark-entrypoint.sh
+
+CMD ["bash","-c","/opt/spark/benchmark-spark-entrypoint.sh && tail -f /dev/null"]
diff --git a/docker/benchmark/images/scripts/arctic-init.sql b/docker/benchmark/images/scripts/arctic-init.sql
deleted file mode 100644
index 8fd9eba9..00000000
--- a/docker/benchmark/images/scripts/arctic-init.sql
+++ /dev/null
@@ -1,281 +0,0 @@
-CREATE DATABASE IF NOT EXISTS arctic;
-
-USE arctic;
-
-CREATE TABLE `catalog_metadata`
-(
- `catalog_id` int(11) NOT NULL AUTO_INCREMENT,
- `catalog_name` varchar(64) NOT NULL COMMENT 'catalog name',
- `display_name` varchar(64) DEFAULT NULL COMMENT 'display name of catalog',
- `catalog_type` varchar(64) NOT NULL COMMENT 'catalog type like hive/hadoop',
- `storage_configs` mediumtext COMMENT 'base64 code of storage configs',
- `auth_configs` mediumtext COMMENT 'base64 code of auth configs',
- `catalog_properties` mediumtext COMMENT 'catalog properties',
- PRIMARY KEY (`catalog_id`),
- UNIQUE KEY `catalog_metadata_catalog_name_uindex` (`catalog_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'catalog metadata';
-
-CREATE TABLE `container_metadata`
-(
- `name` varchar(64) NOT NULL COMMENT 'container name',
- `type` varchar(64) NOT NULL COMMENT 'container type like flink/local',
- `properties` mediumtext COMMENT 'container properties',
- PRIMARY KEY (`name`,`type`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'container metadata';
-
-CREATE TABLE `database_metadata`
-(
- `db_id` int(11) NOT NULL AUTO_INCREMENT,
- `catalog_name` varchar(64) NOT NULL COMMENT 'catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'database name',
- PRIMARY KEY (`db_id`),
- UNIQUE KEY `database_name_uindex` (`catalog_name`,`db_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'database metadata';
-
-CREATE TABLE `file_info_cache`
-(
- `primary_key_md5` varchar(64) NOT NULL COMMENT 'generate md5 with table_identifier+inner_table+file_path+partition_name as primary_key',
- `table_identifier` varchar(384) NOT NULL COMMENT 'table full name with catalog.db.table',
- `add_snapshot_id` bigint(20) NOT NULL COMMENT 'the snapshot id who add this file',
- `parent_snapshot_id` bigint(20) NOT NULL COMMENT 'parent snapshot of add_snapshot_id',
- `delete_snapshot_id` bigint(20) DEFAULT NULL COMMENT 'the snapshot id who delete this file',
- `inner_table` varchar(64) DEFAULT NULL COMMENT 'table type like change/base',
- `file_path` varchar(400) NOT NULL COMMENT 'table type like change/base',
- `file_type` varchar(64) DEFAULT NULL COMMENT 'absolute file path',
- `file_size` bigint(20) DEFAULT NULL COMMENT 'file size',
- `file_mask` bigint(20) DEFAULT NULL COMMENT 'file mask',
- `file_index` bigint(20) DEFAULT NULL COMMENT 'file index',
- `spec_id` bigint(20) DEFAULT NULL COMMENT 'file spec id',
- `record_count` bigint(20) DEFAULT NULL COMMENT 'file record count',
- `partition_name` varchar(256) DEFAULT NULL COMMENT 'the partition name which file belongs to',
- `action` varchar(64) DEFAULT NULL COMMENT 'snapshot type',
- `commit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'file commit time',
- `watermark` timestamp NULL DEFAULT NULL COMMENT 'file max event time',
- `producer` varchar(64) NOT NULL DEFAULT 'INGESTION' COMMENT 'who produce this snapshot',
- PRIMARY KEY (`primary_key_md5`),
- KEY `table_snap_index` (`table_identifier`,`add_snapshot_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'cache files info of table';
-
-CREATE TABLE `optimize_file`
-(
- `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'Auto increment id',
- `optimize_type` varchar(10) NOT NULL COMMENT 'Optimize type: Major, Minor, FullMajor',
- `trace_id` varchar(40) NOT NULL COMMENT 'Optimize task unique id',
- `file_type` varchar(16) NOT NULL COMMENt 'File type: BASE_FILE, INSERT_FILE, EQ_DELETE_FILE, POS_DELETE_FILE',
- `is_target` tinyint(4) DEFAULT '0' COMMENT 'Is file newly generated by optimizing',
- `file_content` varbinary(60000) DEFAULT NULL COMMENT 'File bytes after serialization',
- PRIMARY KEY (`id`),
- KEY `compact_task_id` (`optimize_type`,`trace_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize files for Optimize task';
-
-CREATE TABLE `optimize_history`
-(
- `history_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'History auto increment id',
- `catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'Database name',
- `table_name` varchar(64) NOT NULL COMMENT 'Table name',
- `optimize_range` varchar(10) NOT NULL COMMENT 'Optimize Range: Table, Partition, Node',
- `visible_time` datetime(3) DEFAULT NULL COMMENT 'Latest visible time',
- `commit_time` datetime(3) DEFAULT NULL COMMENT 'Commit time',
- `plan_time` datetime(3) DEFAULT NULL COMMENT 'First plan time',
- `duration` bigint(20) DEFAULT NULL COMMENT 'Execute cost time',
- `total_file_cnt_before` int(11) NOT NULL COMMENT 'Total file cnt before optimizing',
- `total_file_size_before` bigint(20) NOT NULL COMMENT 'Total file size in bytes before optimizing',
- `insert_file_cnt_before` int(11) NOT NULL COMMENT 'Insert file cnt before optimizing',
- `insert_file_size_before` bigint(20) NOT NULL COMMENT 'Insert file size in bytes before optimizing',
- `delete_file_cnt_before` int(11) NOT NULL COMMENT 'Delete file cnt before optimizing',
- `delete_file_size_before` bigint(20) NOT NULL COMMENT 'Delete file size in bytes before optimizing',
- `base_file_cnt_before` int(11) NOT NULL COMMENT 'Base file cnt before optimizing',
- `base_file_size_before` bigint(20) NOT NULL COMMENT 'Base file size in bytes before optimizing',
- `pos_delete_file_cnt_before` int(11) NOT NULL COMMENT 'Pos-Delete file cnt before optimizing',
- `pos_delete_file_size_before` bigint(20) NOT NULL COMMENT 'Pos-Delete file size in bytes before optimizing',
- `total_file_cnt_after` int(11) NOT NULL COMMENT 'Total file cnt after optimizing',
- `total_file_size_after` bigint(20) NOT NULL COMMENT 'Total file cnt after optimizing',
- `snapshot_id` bigint(20) DEFAULT NULL COMMENT 'Snapshot id after commit',
- `total_size` bigint(20) DEFAULT NULL COMMENT 'Total size of the snapshot',
- `added_files` int(11) DEFAULT NULL COMMENT 'Added files cnt of the snapshot',
- `removed_files` int(11) DEFAULT NULL COMMENT 'Removed files cnt of the snapshot',
- `added_records` bigint(20) DEFAULT NULL COMMENT 'Added records of the snapshot',
- `removed_records` bigint(20) DEFAULT NULL COMMENT 'Removed records of the snapshot',
- `added_files_size` bigint(20) DEFAULT NULL COMMENT 'Added files size of the snapshot',
- `removed_files_size` bigint(20) DEFAULT NULL COMMENT 'Removed files size of the snapshot',
- `total_files` bigint(20) DEFAULT NULL COMMENT 'Total file size of the snapshot',
- `total_records` bigint(20) DEFAULT NULL COMMENT 'Total records of the snapshot',
- `partition_cnt` int(11) NOT NULL COMMENT 'Partition cnt for this optimizing',
- `partitions` text COMMENT 'Partitions',
- `max_change_transaction_id` mediumtext COMMENT 'Max change transaction id of these tasks',
- `optimize_type` varchar(10) NOT NULL COMMENT 'Optimize type: Major, Minor',
- PRIMARY KEY (`history_id`),
- KEY `table_name_record` (`catalog_name`,`db_name`,`table_name`,`history_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'History of optimizing after each commit';
-
-CREATE TABLE `optimizer`
-(
- `optimizer_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
- `optimizer_name` varchar(1024) DEFAULT NULL COMMENT 'optimizer name',
- `queue_id` int(11) DEFAULT NULL COMMENT 'queue id',
- `queue_name` varchar(1024) DEFAULT NULL COMMENT 'queue name',
- `optimizer_start_time` varchar(1024) DEFAULT NULL COMMENT 'optimizer start time',
- `optimizer_fail_time` varchar(1024) DEFAULT NULL COMMENT 'optimizer fail time',
- `optimizer_status` varchar(16) DEFAULT NULL COMMENT 'optimizer status',
- `core_number` int(11) DEFAULT NULL COMMENT 'total number of all CPU resources',
- `memory` bigint(30) DEFAULT NULL COMMENT 'optimizer use memory size',
- `parallelism` int(11) DEFAULT NULL COMMENT 'optimizer parallelism',
- `jobmanager_url` varchar(1024) DEFAULT NULL COMMENT 'jobmanager url',
- `optimizer_instance` blob COMMENT 'optimizer instance bytes, use to deserialize optimizer instance',
- `optimizer_state_info` mediumtext COMMENT 'optimizer state info, contains like yarn application id and flink job id',
- `container` varchar(50) DEFAULT '' COMMENT 'name of container which this optimizer belongs to',
- `update_time` timestamp not null default CURRENT_TIMESTAMP COMMENT 'update time',
- PRIMARY KEY (`optimizer_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimizer info';
-
-CREATE TABLE `optimize_group`
-(
- `group_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'Optimize group unique id',
- `name` varchar(50) NOT NULL COMMENT 'Optimize group name',
- `properties` mediumtext COMMENT 'Properties',
- `container` varchar(100) DEFAULT NULL COMMENT 'Container: local, flink',
- PRIMARY KEY (`group_id`),
- UNIQUE KEY `uniqueName` (`name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Group to divide optimize resources';
-
-CREATE TABLE `optimize_task`
-(
- `trace_id` varchar(40) NOT NULL COMMENT 'Optimize task uuid',
- `optimize_type` varchar(10) NOT NULL COMMENT 'Optimize type: Major, Minor',
- `catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'Database name',
- `table_name` varchar(64) NOT NULL COMMENT 'Table name',
- `partition` varchar(128) DEFAULT NULL COMMENT 'Partition',
- `task_commit_group` varchar(40) DEFAULT NULL COMMENT 'UUID. Commit group of task, task of one commit group should commit together',
- `max_change_transaction_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'Max change transaction id',
- `create_time` datetime(3) DEFAULT NULL COMMENT 'Task create time',
- `properties` text COMMENT 'Task properties',
- `queue_id` int(11) NOT NULL COMMENT 'Task group id',
- `insert_files` int(11) DEFAULT NULL COMMENT 'Insert file cnt',
- `delete_files` int(11) DEFAULT NULL COMMENT 'Delete file cnt',
- `base_files` int(11) DEFAULT NULL COMMENT 'Base file cnt',
- `pos_delete_files` int(11) DEFAULT NULL COMMENT 'Pos-Delete file cnt',
- `insert_file_size` bigint(20) DEFAULT NULL COMMENT 'Insert file size in bytes',
- `delete_file_size` bigint(20) DEFAULT NULL COMMENT 'Delete file size in bytes',
- `base_file_size` bigint(20) DEFAULT NULL COMMENT 'Base file size in bytes',
- `pos_delete_file_size` bigint(20) DEFAULT NULL COMMENT 'Pos-Delete file size in bytes',
- `source_nodes` varchar(2048) DEFAULT NULL COMMENT 'Source nodes of task',
- `task_plan_group` varchar(40) DEFAULT NULL COMMENT 'UUID. Plan group of task, task of one plan group are planned together',
- `status` varchar(16) DEFAULT NULL COMMENT 'Optimize Status: Init, Pending, Executing, Failed, Prepared, Committed',
- `pending_time` datetime(3) DEFAULT NULL COMMENT 'Time when task start waiting to execute',
- `execute_time` datetime(3) DEFAULT NULL COMMENT 'Time when task start executing',
- `prepared_time` datetime(3) DEFAULT NULL COMMENT 'Time when task finish executing',
- `report_time` datetime(3) DEFAULT NULL COMMENT 'Time when task report result',
- `commit_time` datetime(3) DEFAULT NULL COMMENT 'Time when task committed',
- `job_type` varchar(16) DEFAULT NULL COMMENT 'Job type',
- `job_id` varchar(32) DEFAULT NULL COMMENT 'Job id',
- `attempt_id` varchar(40) DEFAULT NULL COMMENT 'Attempt id',
- `retry` int(11) DEFAULT NULL COMMENT 'Retry times',
- `fail_reason` varchar(4096) DEFAULT NULL COMMENT 'Error message after task failed',
- `fail_time` datetime(3) DEFAULT NULL COMMENT 'Fail time',
- `new_file_size` bigint(20) DEFAULT NULL COMMENT 'File size generated by task executing',
- `new_file_cnt` int(11) DEFAULT NULL COMMENT 'File cnt generated by task executing',
- `cost_time` bigint(20) DEFAULT NULL COMMENT 'Task Execute cost time',
- PRIMARY KEY (`trace_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize task basic information';
-
-CREATE TABLE `snapshot_info_cache`
-(
- `table_identifier` varchar(384) NOT NULL COMMENT 'table full name with catalog.db.table',
- `snapshot_id` bigint(20) NOT NULL COMMENT 'snapshot id',
- `parent_snapshot_id` bigint(20) NOT NULL COMMENT 'parent snapshot id',
- `action` varchar(64) DEFAULT NULL COMMENT 'snapshot type',
- `inner_table` varchar(64) NOT NULL COMMENT 'table type like change/base',
- `producer` varchar(64) NOT NULL DEFAULT 'INGESTION' COMMENT 'who produce this snapshot',
- `file_size` bigint(20) NOT NULL DEFAULT 0 COMMENT 'file size',
- `file_count` int(11) NOT NULL DEFAULT 0 COMMENT 'file count',
- `commit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'snapshot commit time',
- PRIMARY KEY (`table_identifier`,`inner_table`,`snapshot_id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'cache snapshot info of table';
-
-CREATE TABLE `table_metadata`
-(
- `catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'Database name',
- `table_name` varchar(64) NOT NULL COMMENT 'Table name',
- `primary_key` varchar(256) DEFAULT NULL COMMENT 'Primary key',
- `sort_key` varchar(256) DEFAULT NULL COMMENT 'Sort key',
- `table_location` varchar(256) DEFAULT NULL COMMENT 'Table location',
- `base_location` varchar(256) DEFAULT NULL COMMENT 'Base table location',
- `delta_location` varchar(256) DEFAULT NULL COMMENT 'change table location',
- `properties` text COMMENT 'Table properties',
- `meta_store_site` mediumtext COMMENT 'base64 code of meta store site',
- `hdfs_site` mediumtext COMMENT 'base64 code of hdfs site',
- `core_site` mediumtext COMMENT 'base64 code of core site',
- `hbase_site` mediumtext COMMENT 'base64 code of hbase site',
- `auth_method` varchar(32) DEFAULT NULL COMMENT 'auth method like KERBEROS/SIMPLE',
- `hadoop_username` varchar(64) DEFAULT NULL COMMENT 'hadpp username when auth method is SIMPLE',
- `krb_keytab` text COMMENT 'kerberos keytab when auth method is KERBEROS',
- `krb_conf` text COMMENT 'kerberos conf when auth method is KERBEROS',
- `krb_principal` text COMMENT 'kerberos principal when auth method is KERBEROS',
- `current_tx_id` bigint(20) DEFAULT NULL COMMENT 'current transaction id',
- `cur_schema_id` int(11) NOT NULL DEFAULT 0 COMMENT 'current schema id',
- PRIMARY KEY `table_name_index` (`catalog_name`,`db_name`,`table_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Table metadata';
-
-CREATE TABLE `optimize_table_runtime`
-(
- `catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'Database name',
- `table_name` varchar(64) NOT NULL COMMENT 'Table name',
- `current_snapshot_id` bigint(20) NOT NULL DEFAULT '-1' COMMENT 'Base table current snapshot id',
- `latest_major_optimize_time` mediumtext COMMENT 'Latest Major Optimize time for all partitions',
- `latest_minor_optimize_time` mediumtext COMMENT 'Latest Minor Optimize time for all partitions',
- `latest_task_plan_group` varchar(40) DEFAULT NULL COMMENT 'Latest task plan group',
- `optimize_status` varchar(20) DEFAULT 'Idle' COMMENT 'Table optimize status: MajorOptimizing, MinorOptimizing, Pending, Idle',
- `optimize_status_start_time` datetime(3) DEFAULT NULL COMMENT 'Table optimize status start time',
- `current_change_snapshotId` bigint(20) DEFAULT NULL COMMENT 'Change table current snapshot id',
- `latest_full_optimize_time` MEDIUMTEXT NULL COMMENT 'Latest Full Optimize time for all partitions',
- PRIMARY KEY `table_name_index` (`catalog_name`,`db_name`,`table_name`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'Optimize running information of each table';
-
-CREATE TABLE `optimize_task_history`
-(
- `task_trace_id` varchar(50) NOT NULL COMMENT 'Optimize task uuid',
- `retry` int(11) NOT NULL COMMENT 'Retry times for the same task_trace_id',
- `task_plan_group` varchar(40) NOT NULL COMMENT 'Plan group of task, task of one plan group are planned together',
- `catalog_name` varchar(64) NOT NULL COMMENT 'Catalog name',
- `db_name` varchar(64) NOT NULL COMMENT 'Database name',
- `table_name` varchar(64) NOT NULL COMMENT 'Table name',
- `start_time` datetime(3) DEFAULT NULL COMMENT 'Task start time',
- `end_time` datetime(3) DEFAULT NULL COMMENT 'Task end time',
- `cost_time` bigint(20) DEFAULT NULL COMMENT 'Task cost time',
- `queue_id` int(11) DEFAULT NULL COMMENT 'Queue id which execute task',
- PRIMARY KEY (`task_trace_id`, `retry`),
- KEY `table_end_time_plan_group_index` (`catalog_name`, `db_name`, `table_name`, `end_time`, `task_plan_group`),
- KEY `table_plan_group_index` (`catalog_name`, `db_name`, `table_name`, `task_plan_group`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'History of each optimize task execute';
-
-CREATE TABLE `table_transaction_meta`
-(
- `table_identifier` varchar(384) NOT NULL COMMENT 'table full name with catalog.db.table',
- `transaction_id` bigint(20) NOT NULL COMMENT 'allocated transaction id',
- `signature` varchar(256) NOT NULL COMMENT 'transaction request signature',
- `commit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'transaction allocate time',
- PRIMARY KEY (`table_identifier`,`transaction_id`),
- UNIQUE KEY `signature_unique` (`table_identifier`,`signature`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'transaction meta info of table';
-
-CREATE TABLE `api_tokens`
-(
- `id` int(11) NOT NULL AUTO_INCREMENT,
- `apikey` varchar(256) NOT NULL COMMENT 'openapi client public key',
- `secret` varchar(256) NOT NULL COMMENT 'The key used by the client to generate the request signature',
- `apply_time` datetime DEFAULT NULL COMMENT 'apply time',
- PRIMARY KEY (`id`) USING BTREE,
- UNIQUE KEY `account_unique` (`apikey`) USING BTREE COMMENT 'account unique'
-) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='Openapi secret';
-
-CREATE TABLE `ddl_record`
-(
- `table_identifier` varchar(384) NOT NULL COMMENT 'table full name with catalog.db.table',
- `ddl` mediumtext COMMENT 'ddl',
- `ddl_type` varchar(256) NOT NULL COMMENT 'ddl type',
- `commit_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'ddl commit time'
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT 'ddl record of table';
\ No newline at end of file
diff --git a/docker/benchmark/images/scripts/benchmark-ams-entrypoint.sh b/docker/benchmark/images/scripts/benchmark-ams-entrypoint.sh
deleted file mode 100644
index 768f07c7..00000000
--- a/docker/benchmark/images/scripts/benchmark-ams-entrypoint.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/bash
-sleep 20
-/opt/arctic/bin/ams.sh start
\ No newline at end of file
diff --git a/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh b/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
new file mode 100644
index 00000000..003a963d
--- /dev/null
+++ b/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+SQL_RESULT=""
+while [[ "${SQL_RESULT}" != 1 ]]
+do
+ echo "Wait for table initialization to complete..."
+ sleep 1
+ SQL_RESULT=$(mysql -h mysql -P 3306 --database=metastore \
+ --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" \
+ --execute="select VER_ID from VERSION;" \
+ -s -N)
+done
+echo "MySQL initialization is successful, starting Spark Thrift Server..."
+
+sbin/start-thriftserver.sh
\ No newline at end of file
diff --git a/docker/benchmark/images/spark-config/spark-defaults.conf b/docker/benchmark/images/spark-config/spark-defaults.conf
index 5f717d8e..aba9ba5d 100644
--- a/docker/benchmark/images/spark-config/spark-defaults.conf
+++ b/docker/benchmark/images/spark-config/spark-defaults.conf
@@ -5,6 +5,7 @@ spark.sql.catalog.local_catalog=com.netease.arctic.spark.ArcticSparkCatalog
spark.sql.catalog.local_catalog.url=thrift://ams:1260/local_catalog
#Iceberg
+spark.sql.iceberg.handle-timestamp-without-timezone=true
spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions
spark.sql.catalog.iceberg_catalog=org.apache.iceberg.spark.SparkCatalog
spark.sql.catalog.iceberg_catalog.type=hive
From bc7d84f42279148320e0121941c001cf46b5d9f2 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 23 Nov 2022 14:51:04 +0800
Subject: [PATCH 02/18] polish document and change some settings in config
---
docker/benchmark/README.md | 155 ++++++++++++------
docker/benchmark/docker-compose.yml | 4 +-
.../benchmark-config/spark_arctic_config.xml | 4 +-
.../benchmark-config/spark_iceberg_config.xml | 2 +-
.../images/spark-config/spark-defaults.conf | 4 -
5 files changed, 108 insertions(+), 61 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 2177b457..1e8ee98e 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -1,13 +1,14 @@
## 介绍
-Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用户熟悉 Benchamrk 流程。其中 Hdfs 文件系统用本地文件系统代替,所以确保运行目录有足够存储空间
+Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用户熟悉 Benchmark 流程。其中 HDFS 文件系统用本地文件系统代替,所以确保运行目录有足够存储空间。相关配置文件已挂载到宿主机,修改主机中的配置文件即可同步到容器。
## 使用
+本 Docker 环境使用介绍仅为引导用户进行简单入门,熟悉之后建议配合 Arctic 官方 [Benchmark流程](https://github.com/NetEase/arctic/blob/master/site/docs/ch/benchmark/benchmark-step.md) 文档以及本项目主页文档进行更为深入的测试与使用。
进入 docker/benchmark 目录下
-如果需要自己build镜像需要先执行
+远程仓库 DockerHub 中已上传构建好的镜像,如需自己构建镜像需要先执行一下命令构建镜像:
```
./build-image.sh
```
-构建镜像
+
如果不构建镜像也可以从远程仓库下载,不过需要初始化环境变量
```
source .env
@@ -17,11 +18,10 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
```
docker-compose up -d
```
-即可通过 docker-compose (如果没有 docker-compose 那么需要安装)拉起全部容器,主要有 mysql,hive,ams,trino,presto,spark,lakehouse-benchmark,lakehouse-benchmark-ingestion
-其中 hive 是测试 iceberg 和 hudi 时需要的,presto 是专门测试 hudi 用的。其中 lakehouse-benchmark,lakehouse-benchmark-ingestion 两个是静态容器
-只有配置好的环境信息,用户需要执行特定的命令触发运行。
+即可通过 docker-compose (如果没有 docker-compose 那么需要安装)拉起全部容器,主要有 mysql,hive, ams, trino, presto, spark, lakehouse-benchmark, lakehouse-benchmark-ingestion
+其中 hive 是测试 iceberg 和 hudi 时需要的,presto 是专门测试 hudi 用的。
- - 使用如下命令进入
+ - 使用如下命令生成静态数据到 mysql :
```
docker exec -it lakehouse-benchmark \
java -jar lakehouse-benchmark.jar \
@@ -29,8 +29,8 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/mysql/sample_chbenchmark_config.xml \
--create=true --load=true
```
- 生成静态数据进入 mysql。
- - 使用如下命令进入
+
+ - 使用如下命令开启数据同步程序,将数据库的数据实时同步到数据湖
```
docker exec -it benchmark-lakehouse-ingestion \
java -cp lakehouse-benchmark-ingestion-1.0-SNAPSHOT.jar \
@@ -39,10 +39,11 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-sinkType [arctic/iceberg/hudi] \
-sinkDatabase [arctic/iceberg/hudi]
```
- 上述命令需要选择 sinkType 及 sinkDatabase 参数,命令行参数的具体说明请参考[lakehouse-benchmark-ingestion](https://github.com/NetEase/lakehouse-benchmark-ingestion)
- ingestion 服务可以通过宿主机上的localhost:8081页面打开 Flink Web UI,观察数据同步情况。
- - 等 lakehouse-benchmark-ingestion 容器同步完数据以后在进入lakehouse-benchmark 容器,进行静态数据查询性能测试
- - arctic
+ 上述命令需要选择 sinkType 及 sinkDatabase 参数,命令行参数的具体说明请参考 [lakehouse-benchmark-ingestion](https://github.com/NetEase/lakehouse-benchmark-ingestion)。
+ 可以通过宿主机上的 `localhost:8081` 页面打开 [Flink Web UI](localhost:8081),观察数据同步情况。
+ 观察 Flink Web UI ,通过 source 算子的 Records Sent 指标观察数据同步的情况,当该指标不再增加时,表示全量数据同步完成。
+ - 等 lakehouse-benchmark-ingestion 容器同步完数据以后,保留此窗口以便后续使用以及观察日志。再新建一个窗口执行命令进入lakehouse-benchmark 容器,进行静态数据查询性能测试,推荐使用 Trino 进行测试:
+ - Arctic
```
docker exec -it lakehouse-benchmark \
java -jar lakehouse-benchmark.jar \
@@ -50,7 +51,7 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_arctic_config.xml \
--create=false --load=false --execute=true
```
- - iceberg
+ - Iceberg
```
docker exec -it lakehouse-benchmark \
java -jar lakehouse-benchmark.jar \
@@ -58,7 +59,7 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - hudi
+ - Hudi
```
docker exec -it lakehouse-benchmark \
java -jar lakehouse-benchmark.jar \
@@ -66,40 +67,90 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/presto_hudi_config.xml \
--create=false --load=false --execute=true
```
- - 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,进入 lakehouse-benchmark 容器
- 先执行产生tpcc数据的命令:
- ```
- docker exec -it lakehouse-benchmark \
- nohup java -jar lakehouse-benchmark.jar \
- -b tpcc,chbenchmark \
- -c config/mysql/sample_chbenchmark_config.xml \
- --execute=true -s 5 >> run.log1 2>&1 &
- ```
- 然后同时执行tpch性能查询的命令:
- - arctic
- ```
- docker exec -it lakehouse-benchmark \
- nohup java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/trino_arctic_config.xml \
- --create=false --load=false --execute=true >> run.log2 2>&1 &
- ```
- - iceberg
- ```
- docker exec -it lakehouse-benchmark \
- nohup java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/trino_iceberg_config.xml \
- --create=false --load=false --execute=true >> run.log2 2>&1 &
- ```
- - hudi
- ```
- docker exec -it lakehouse-benchmark \
- nohup java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=false --load=false --execute=true >> run.log2 2>&1 &
- ```
-
- 进入 lakehouse-benchmark 容器,配置放在 config 目录下,如果想要测试 hudi 需要使用 config/trino/presto_chbenchmark_config.xml 配置文件,
- 如果需要测试 iceberg 等库需要修改 config/trino/trino_chbenchmark_config.xml 里面的 catalog 和 database 名称。
\ No newline at end of file
+ - 本 Docker 环境也支持使用 Spark 进行测试:
+ - Arctic
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_arctic_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Iceberg
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_iceberg_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
+
+ - 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,
+ 进入 lakehouse-benchmark 容器执行命令向 Mysql 里生产增量数据,这些数据会通过已经运行的数据同步工具源源不断写入数据湖:
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b tpcc,chbenchmark \
+ -c config/mysql/sample_chbenchmark_config.xml \
+ --execute=true -s 5
+ ```
+ 再新建一个窗口,然后同时执行 TPCH 性能查询的命令 (Trino) :
+ - Arctic
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/trino_arctic_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Iceberg
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/trino_iceberg_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ 也可以使用 Spark :
+ - Arctic
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_arctic_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Iceberg
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_iceberg_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
+## 测试结果
+测试跑完以后会在 `lakehouse-benchmark` 容器 `/usr/lib/lakehouse-benchmark/` 目录下生成一个 `results` 目录,测试结果都在里面,主要关注两个文件,第一:`xxx.summary.json` 文件, 这里面的 Average Latency 项显示的是本次性能测试的平均响应时间,第二:`xxx.statistic.csv` 文件,里面记录了每个 Query 类型的最大,最小,平均耗时。
\ No newline at end of file
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index a25eb11e..674fcfaa 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -54,7 +54,7 @@ services:
- ./images/trino-presto-config/iceberg.properties:/etc/trino/catalog/iceberg.properties
- ./images/trino-presto-config/delta-lake.properties:/etc/trino/catalog/delta-lake.properties
ports:
- - 9001:8080
+ - 9003:8080
depends_on:
- ams
- metastore
@@ -67,7 +67,7 @@ services:
- ./hive:/tmp/hive/warehouse
- ./images/trino-presto-config/hudi.properties:/opt/presto-server/etc/catalog/hudi.properties
ports:
- - 9002:8080
+ - 9004:8080
depends_on:
- ams
- metastore
diff --git a/docker/benchmark/images/benchmark-config/spark_arctic_config.xml b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
index 55117f26..3f0678b0 100644
--- a/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
+++ b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
@@ -4,7 +4,7 @@
HIVE
org.apache.hive.jdbc.HiveDriver
- jdbc:hive2://spark:10000/local_catalog
+ jdbc:hive2://spark:10000/local_catalog.arctic
hdfs
TRANSACTION_READ_UNCOMMITTED
@@ -129,4 +129,4 @@
StockLevel
-
\ No newline at end of file
+
diff --git a/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
index 2457ce3d..7fbcfa37 100644
--- a/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
+++ b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
@@ -4,7 +4,7 @@
HIVE
org.apache.hive.jdbc.HiveDriver
- jdbc:hive2://spark:10000/iceberg_catalog
+ jdbc:hive2://spark:10000/iceberg_catalog.iceberg
hdfs
TRANSACTION_READ_UNCOMMITTED
diff --git a/docker/benchmark/images/spark-config/spark-defaults.conf b/docker/benchmark/images/spark-config/spark-defaults.conf
index aba9ba5d..0f7903a2 100644
--- a/docker/benchmark/images/spark-config/spark-defaults.conf
+++ b/docker/benchmark/images/spark-config/spark-defaults.conf
@@ -14,7 +14,3 @@ spark.sql.catalog.iceberg_catalog.uri=thrift://metastore:9083
#hudi
spark.serializer=org.apache.spark.serializer.KryoSerializer
spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension
-
-#delta
-spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension
-spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog
From 3d0b85070bb6659f6b631965f6bcdb6764677482 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 23 Nov 2022 14:51:52 +0800
Subject: [PATCH 03/18] polish document and change some settings in config
---
docker/benchmark/docker-compose.yml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index 674fcfaa..a25eb11e 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -54,7 +54,7 @@ services:
- ./images/trino-presto-config/iceberg.properties:/etc/trino/catalog/iceberg.properties
- ./images/trino-presto-config/delta-lake.properties:/etc/trino/catalog/delta-lake.properties
ports:
- - 9003:8080
+ - 9001:8080
depends_on:
- ams
- metastore
@@ -67,7 +67,7 @@ services:
- ./hive:/tmp/hive/warehouse
- ./images/trino-presto-config/hudi.properties:/opt/presto-server/etc/catalog/hudi.properties
ports:
- - 9004:8080
+ - 9002:8080
depends_on:
- ams
- metastore
From 30cbcf251217eedae613edc723c48d911319c3be Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 23 Nov 2022 14:59:22 +0800
Subject: [PATCH 04/18] polish document and change some settings in config
---
docker/benchmark/README.md | 100 ++++++++++++++++++-------------------
1 file changed, 50 insertions(+), 50 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 1e8ee98e..8e073499 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -93,64 +93,64 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
--create=false --load=false --execute=true
```
- - 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,
- 进入 lakehouse-benchmark 容器执行命令向 Mysql 里生产增量数据,这些数据会通过已经运行的数据同步工具源源不断写入数据湖:
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b tpcc,chbenchmark \
- -c config/mysql/sample_chbenchmark_config.xml \
- --execute=true -s 5
- ```
- 再新建一个窗口,然后同时执行 TPCH 性能查询的命令 (Trino) :
- - Arctic
+ - 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,
+ 进入 lakehouse-benchmark 容器执行命令向 Mysql 里生产增量数据,这些数据会通过已经运行的数据同步工具源源不断写入数据湖:
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b tpcc,chbenchmark \
+ -c config/mysql/sample_chbenchmark_config.xml \
+ --execute=true -s 5
+ ```
+ - 再新建一个窗口,然后同时执行 TPCH 性能查询的命令 (Trino) :
+ - Arctic
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/trino_arctic_config.xml \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/trino_arctic_config.xml \
+ --create=false --load=false --execute=true
```
- - Iceberg
+ - Iceberg
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/trino_iceberg_config.xml \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/trino_iceberg_config.xml \
+ --create=false --load=false --execute=true
```
- - Hudi
+ - Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ --create=false --load=false --execute=true
```
- 也可以使用 Spark :
- - Arctic
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_arctic_config.xml \
- --create=false --load=false --execute=true
- ```
- - Iceberg
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_iceberg_config.xml \
- --create=false --load=false --execute=true
- ```
- - Hudi
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
- --create=false --load=false --execute=true
- ```
+ - 也可以使用 Spark :
+ - Arctic
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_arctic_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Iceberg
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_iceberg_config.xml \
+ --create=false --load=false --execute=true
+ ```
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
## 测试结果
测试跑完以后会在 `lakehouse-benchmark` 容器 `/usr/lib/lakehouse-benchmark/` 目录下生成一个 `results` 目录,测试结果都在里面,主要关注两个文件,第一:`xxx.summary.json` 文件, 这里面的 Average Latency 项显示的是本次性能测试的平均响应时间,第二:`xxx.statistic.csv` 文件,里面记录了每个 Query 类型的最大,最小,平均耗时。
\ No newline at end of file
From f73576cd80015ac34e49aa77191e449b28099666 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 15:01:17 +0800
Subject: [PATCH 05/18] polish document and change some settings in config
---
.run/chbenchmark - spark.run.xml | 2 +-
docker/benchmark/README.md | 62 ++++++++++---------
.../benchmark-lakehouse-ingestion.Dockerfile | 2 +-
3 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/.run/chbenchmark - spark.run.xml b/.run/chbenchmark - spark.run.xml
index 7194ee85..2d7a84e7 100644
--- a/.run/chbenchmark - spark.run.xml
+++ b/.run/chbenchmark - spark.run.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 8e073499..d69e5c9e 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -40,7 +40,7 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-sinkDatabase [arctic/iceberg/hudi]
```
上述命令需要选择 sinkType 及 sinkDatabase 参数,命令行参数的具体说明请参考 [lakehouse-benchmark-ingestion](https://github.com/NetEase/lakehouse-benchmark-ingestion)。
- 可以通过宿主机上的 `localhost:8081` 页面打开 [Flink Web UI](localhost:8081),观察数据同步情况。
+ 可以通过宿主机上的 `localhost:8081` 页面打开 [Flink Web UI](http://localhost:8081),观察数据同步情况。
观察 Flink Web UI ,通过 source 算子的 Records Sent 指标观察数据同步的情况,当该指标不再增加时,表示全量数据同步完成。
- 等 lakehouse-benchmark-ingestion 容器同步完数据以后,保留此窗口以便后续使用以及观察日志。再新建一个窗口执行命令进入lakehouse-benchmark 容器,进行静态数据查询性能测试,推荐使用 Trino 进行测试:
- Arctic
@@ -59,13 +59,22 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
+ - Hudi
+ 因为 Hudi 的表名带有后缀,Hudi 的测试步骤稍复杂
+ 先进入 benchmark 容器:
```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=false --load=false --execute=true
+ docker exec -it lakehouse-benchmark /bin/bash
+ ```
+ 声明表后缀:
+ ```
+ export tpcc_name_suffix=_rt
+ ```
+ 执行性能测试:
+ ```
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ --create=false --load=false --execute=true
```
- 本 Docker 环境也支持使用 Spark 进行测试:
- Arctic
@@ -84,14 +93,8 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/spark/spark_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
- --create=false --load=false --execute=true
- ```
+ - Hudi(暂不支持)
+
- 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,
进入 lakehouse-benchmark 容器执行命令向 Mysql 里生产增量数据,这些数据会通过已经运行的数据同步工具源源不断写入数据湖:
@@ -119,14 +122,22 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
+ - Hudi
+ 先进入 benchmark 容器:
```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=false --load=false --execute=true
+ docker exec -it lakehouse-benchmark /bin/bash
+ ```
+ 声明表后缀:
+ ```
+ export tpcc_name_suffix=_rt
+ ```
+ 执行性能测试:
```
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ --create=fal
+
- 也可以使用 Spark :
- Arctic
```
@@ -144,13 +155,6 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/spark/spark_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
- ```
- docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
- --create=false --load=false --execute=true
- ```
+ - Hudi(暂不支持)
## 测试结果
测试跑完以后会在 `lakehouse-benchmark` 容器 `/usr/lib/lakehouse-benchmark/` 目录下生成一个 `results` 目录,测试结果都在里面,主要关注两个文件,第一:`xxx.summary.json` 文件, 这里面的 Average Latency 项显示的是本次性能测试的平均响应时间,第二:`xxx.statistic.csv` 文件,里面记录了每个 Query 类型的最大,最小,平均耗时。
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-lakehouse-ingestion.Dockerfile b/docker/benchmark/images/benchmark-lakehouse-ingestion.Dockerfile
index 1d3e8501..07fe3a94 100644
--- a/docker/benchmark/images/benchmark-lakehouse-ingestion.Dockerfile
+++ b/docker/benchmark/images/benchmark-lakehouse-ingestion.Dockerfile
@@ -3,7 +3,7 @@ FROM arctic163/benchmark-base:${BENCHMARK_VERSION}
RUN set -x && \
mkdir -p /usr/lib/lakehouse_benchmark_ingestion && \
- wget -q https://github.com/NetEase/lakehouse-benchmark-ingestion/releases/download/1.0/lakehouse_benchmark_ingestion.tar.gz && \
+ wget -q https://github.com/NetEase/lakehouse-benchmark-ingestion/releases/download/beta-1.0-arctic-0.4/lakehouse_benchmark_ingestion.tar.gz && \
tar -xzf lakehouse_benchmark_ingestion.tar.gz -C /usr/lib/lakehouse_benchmark_ingestion && \
rm lakehouse_benchmark_ingestion.tar.gz
From 1f179ccb69d2e0f6b72edd5db7cee5af6cfc5da8 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 15:56:05 +0800
Subject: [PATCH 06/18] add suffix in java -D param
---
docker/benchmark/README.md | 42 +++++++------------
.../images/benchmark-trino.Dockerfile | 2 -
.../chbenchmark/TableNames.java | 4 +-
.../chbenchmark/TableNames.java | 5 ++-
4 files changed, 20 insertions(+), 33 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index d69e5c9e..22b56638 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -59,22 +59,14 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
- 因为 Hudi 的表名带有后缀,Hudi 的测试步骤稍复杂
- 先进入 benchmark 容器:
+ - Hudi
```
- docker exec -it lakehouse-benchmark /bin/bash
- ```
- 声明表后缀:
- ```
- export tpcc_name_suffix=_rt
- ```
- 执行性能测试:
- ```
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=false --load=false --execute=true
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ -Dtpcc_name_suffix=_rt \
+ --create=false --load=false --execute=true
```
- 本 Docker 环境也支持使用 Spark 进行测试:
- Arctic
@@ -122,21 +114,15 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/trino/trino_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi
- 先进入 benchmark 容器:
+ - Hudi
```
- docker exec -it lakehouse-benchmark /bin/bash
- ```
- 声明表后缀:
- ```
- export tpcc_name_suffix=_rt
- ```
- 执行性能测试:
+ docker exec -it lakehouse-benchmark \
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ -Dtpcc_name_suffix=_rt \
+ --create=false --load=false --execute=true
```
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- --create=fal
- 也可以使用 Spark :
- Arctic
diff --git a/docker/benchmark/images/benchmark-trino.Dockerfile b/docker/benchmark/images/benchmark-trino.Dockerfile
index 67a5ca0e..fc61bf35 100644
--- a/docker/benchmark/images/benchmark-trino.Dockerfile
+++ b/docker/benchmark/images/benchmark-trino.Dockerfile
@@ -19,8 +19,6 @@ USER root
RUN yum install -y wget
-USER trino:trino
-
WORKDIR /usr/lib/trino/plugin/arctic
RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/trino-arctic-${ARCTIC_VERSION}.tar.gz \
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForSpark/chbenchmark/TableNames.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForSpark/chbenchmark/TableNames.java
index 410f2fe7..b64ad887 100644
--- a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForSpark/chbenchmark/TableNames.java
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForSpark/chbenchmark/TableNames.java
@@ -2,7 +2,9 @@
public class TableNames {
- private static final String suffix = System.getenv("tpcc_name_suffix") == null ? "" : System.getenv("tpcc_name_suffix");
+ private static final String suffix = System.getenv("tpcc_name_suffix") == null ?
+ System.getProperty("tpcc_name_suffix") == null ? "" : System.getProperty("tpcc_name_suffix") :
+ System.getenv("tpcc_name_suffix");
private static final String prefix = System.getenv("tpcc_name_prefix") == null ? "" : System.getenv("tpcc_name_prefix");
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForTrino/chbenchmark/TableNames.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForTrino/chbenchmark/TableNames.java
index 6fb3c55c..25028070 100644
--- a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForTrino/chbenchmark/TableNames.java
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmarkForTrino/chbenchmark/TableNames.java
@@ -2,8 +2,9 @@
public class TableNames {
- private static final String suffix = System.getenv("tpcc_name_suffix") == null ? "" : System.getenv("tpcc_name_suffix");
-
+ private static final String suffix = System.getenv("tpcc_name_suffix") == null ?
+ System.getProperty("tpcc_name_suffix") == null ? "" : System.getProperty("tpcc_name_suffix") :
+ System.getenv("tpcc_name_suffix");
public static String warehouse(){
return quote("warehouse" + suffix);
From 548493f8a07b84331fe2c3851fd70b5fc726032c Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 15:59:22 +0800
Subject: [PATCH 07/18] add suffix in java -D param
---
docker/benchmark/README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 22b56638..9cb747dc 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -117,11 +117,11 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
- Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ -Dtpcc_name_suffix=_rt \
+ --create=false --load=false --execute=true
```
- 也可以使用 Spark :
From ef861ac29fb7c8731330e68e7931eb4c89d16af4 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 16:01:05 +0800
Subject: [PATCH 08/18] add suffix in java -D param
---
docker/benchmark/README.md | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 9cb747dc..7cab6750 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -63,8 +63,8 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
```
docker exec -it lakehouse-benchmark \
java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
-Dtpcc_name_suffix=_rt \
--create=false --load=false --execute=true
```
@@ -117,11 +117,11 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
- Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForSpark \
- -c config/spark/spark_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ -Dtpcc_name_suffix=_rt \
+ --create=false --load=false --execute=true
```
- 也可以使用 Spark :
From b7dbbe75fd4be48ffd0e9eeb2ae342ee04839c14 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 16:01:45 +0800
Subject: [PATCH 09/18] add suffix in java -D param
---
docker/benchmark/README.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 7cab6750..feb48c41 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -117,11 +117,11 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
- Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
- -b chbenchmarkForTrino \
- -c config/trino/presto_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
- --create=false --load=false --execute=true
+ java -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForTrino \
+ -c config/trino/presto_hudi_config.xml \
+ -Dtpcc_name_suffix=_rt \
+ --create=false --load=false --execute=true
```
- 也可以使用 Spark :
From dcd04d147bd4e4350d246e36e5b76b9ff62d9140 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 16:14:41 +0800
Subject: [PATCH 10/18] add suffix in java -D param
---
.run/chbenchmark - trino.run.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.run/chbenchmark - trino.run.xml b/.run/chbenchmark - trino.run.xml
index dce57ae4..293385a4 100644
--- a/.run/chbenchmark - trino.run.xml
+++ b/.run/chbenchmark - trino.run.xml
@@ -2,7 +2,8 @@
-
+
+
From 456fa91cba7a60ceadc941331e545f73f1abb361 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 18:28:58 +0800
Subject: [PATCH 11/18] polish doc
---
docker/benchmark/README.md | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index feb48c41..fd2121eb 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -62,10 +62,9 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
- Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
+ java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
-b chbenchmarkForTrino \
-c config/trino/presto_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
--create=false --load=false --execute=true
```
- 本 Docker 环境也支持使用 Spark 进行测试:
@@ -117,10 +116,9 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
- Hudi
```
docker exec -it lakehouse-benchmark \
- java -jar lakehouse-benchmark.jar \
+ java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
-b chbenchmarkForTrino \
-c config/trino/presto_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
--create=false --load=false --execute=true
```
From 7bcb87fa4b696d5ce673cb585e330aaeee0f0874 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Wed, 30 Nov 2022 18:32:29 +0800
Subject: [PATCH 12/18] polish doc
---
docker/benchmark/README.md | 2 --
1 file changed, 2 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index 3c38dd06..fd2121eb 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -65,7 +65,6 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
-b chbenchmarkForTrino \
-c config/trino/presto_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
--create=false --load=false --execute=true
```
- 本 Docker 环境也支持使用 Spark 进行测试:
@@ -120,7 +119,6 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
-b chbenchmarkForTrino \
-c config/trino/presto_hudi_config.xml \
- -Dtpcc_name_suffix=_rt \
--create=false --load=false --execute=true
```
From 41cf42b84c0933c367f85833d031cf3b71cc0e8b Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Thu, 1 Dec 2022 14:03:05 +0800
Subject: [PATCH 13/18] change spark guidance
---
docker/benchmark/README.md | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/docker/benchmark/README.md b/docker/benchmark/README.md
index fd2121eb..2141daa5 100644
--- a/docker/benchmark/README.md
+++ b/docker/benchmark/README.md
@@ -84,7 +84,14 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/spark/spark_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi(暂不支持)
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
- 上述测试的是静态数据,数据中不包含 update,delete,如果想测试动态数据需要边向 Mysql 造数据边测试查询,
@@ -139,6 +146,13 @@ Docker 的全套 Benchmark 容器只支持单机版本,主要是为了让用
-c config/spark/spark_iceberg_config.xml \
--create=false --load=false --execute=true
```
- - Hudi(暂不支持)
+ - Hudi
+ ```
+ docker exec -it lakehouse-benchmark \
+ java -Dtpcc_name_suffix=_rt -jar lakehouse-benchmark.jar \
+ -b chbenchmarkForSpark \
+ -c config/spark/spark_hudi_config.xml \
+ --create=false --load=false --execute=true
+ ```
## 测试结果
测试跑完以后会在 `lakehouse-benchmark` 容器 `/usr/lib/lakehouse-benchmark/` 目录下生成一个 `results` 目录,测试结果都在里面,主要关注两个文件,第一:`xxx.summary.json` 文件, 这里面的 Average Latency 项显示的是本次性能测试的平均响应时间,第二:`xxx.statistic.csv` 文件,里面记录了每个 Query 类型的最大,最小,平均耗时。
\ No newline at end of file
From 2bcb81beccc332e9461253b48fe6f28f417f964b Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Fri, 2 Dec 2022 15:49:47 +0800
Subject: [PATCH 14/18] change spark guidance
---
docker/benchmark/docker-compose.yml | 3 +
.../benchmark/images/ams-config/ams-init.sql | 274 ++++++++++++++++++
docker/benchmark/images/ams-config/config.sh | 25 ++
.../benchmark-config/presto_hudi_config.xml | 2 +-
.../sample_chbenchmark_config.xml | 2 +-
.../benchmark-config/spark_arctic_config.xml | 2 +-
.../benchmark-config/spark_hudi_config.xml | 2 +-
.../benchmark-config/spark_iceberg_config.xml | 2 +-
.../benchmark-config/trino_arctic_config.xml | 2 +-
.../benchmark-config/trino_iceberg_config.xml | 2 +-
.../images/benchmark-spark.Dockerfile | 3 +-
11 files changed, 310 insertions(+), 9 deletions(-)
create mode 100644 docker/benchmark/images/ams-config/ams-init.sql
create mode 100644 docker/benchmark/images/ams-config/config.sh
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index 05253ee0..822af7b4 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -36,7 +36,10 @@ services:
hostname: ams
volumes:
- ./arctic:/tmp/arctic/warehouse
+ - ./hive:/tmp/hive/warehouse
- ./images/ams-config/arctic-config.yaml:/opt/arctic/conf/config.yaml
+ - ./images/ams-config/ams-init.sql:/opt/arctic/conf/derby/ams-init.sql
+ - ./images/ams-config/config.sh:/opt/arctic/bin/config.sh
ports:
- 1630:1630
- 1260:1260
diff --git a/docker/benchmark/images/ams-config/ams-init.sql b/docker/benchmark/images/ams-config/ams-init.sql
new file mode 100644
index 00000000..44a65080
--- /dev/null
+++ b/docker/benchmark/images/ams-config/ams-init.sql
@@ -0,0 +1,274 @@
+
+CREATE TABLE optimize_group (
+ group_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ name varchar(50) unique NOT NULL,
+ properties clob(64m),
+ container varchar(64) DEFAULT NULL,
+ PRIMARY KEY (group_id)
+ );
+
+CREATE TABLE catalog_metadata(
+ catalog_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ catalog_name varchar(64) unique NOT NULL,
+ catalog_type varchar(64) NOT NULL,
+ storage_configs clob(64m),
+ auth_configs clob(64m),
+ catalog_properties clob(64m),
+ PRIMARY KEY (catalog_id)
+ );
+
+CREATE TABLE optimizer (
+ optimizer_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ optimizer_name varchar(1024) DEFAULT NULL,
+ queue_id bigint DEFAULT NULL,
+ queue_name varchar(1024) DEFAULT NULL,
+ optimizer_start_time varchar(1024) DEFAULT NULL,
+ optimizer_fail_time varchar(1024) DEFAULT NULL,
+ optimizer_status varchar(16) DEFAULT NULL,
+ core_number bigint DEFAULT NULL,
+ memory bigint DEFAULT NULL,
+ parallelism bigint DEFAULT NULL,
+ jobmanager_url varchar(1024) DEFAULT NULL,
+ optimizer_instance blob,
+ optimizer_state_info clob(64m),
+ container varchar(50) DEFAULT '',
+ update_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (optimizer_id)
+ );
+
+CREATE TABLE container_metadata (
+ name varchar(64) NOT NULL,
+ type varchar(64) NOT NULL,
+ properties clob(64m),
+ PRIMARY KEY (name, type)
+);
+
+CREATE TABLE snapshot_info_cache (
+ table_identifier varchar(384) NOT NULL,
+ snapshot_id bigint NOT NULL,
+ snapshot_sequence bigint NOT NULL DEFAULT -1,
+ parent_snapshot_id bigint NOT NULL,
+ action varchar(64) DEFAULT NULL,
+ inner_table varchar(64) NOT NULL,
+ producer varchar(64) NOT NULL DEFAULT 'INGESTION',
+ file_size bigint NOT NULL DEFAULT 0,
+ file_count int NOT NULL DEFAULT 0,
+ commit_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (table_identifier,inner_table,snapshot_id)
+ );
+
+CREATE TABLE optimize_task (
+ trace_id varchar(40) NOT NULL,
+ optimize_type varchar(10) NOT NULL,
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ table_name varchar(128) NOT NULL,
+ partition varchar(128) DEFAULT NULL,
+ task_commit_group varchar(40) DEFAULT NULL,
+ max_change_transaction_id bigint NOT NULL WITH DEFAULT -1,
+ create_time timestamp DEFAULT NULL,
+ properties clob(64m),
+ queue_id bigint NOT NULL,
+ insert_files bigint DEFAULT NULL,
+ delete_files bigint DEFAULT NULL,
+ base_files bigint DEFAULT NULL,
+ pos_delete_files bigint DEFAULT NULL,
+ eq_delete_files bigint DEFAULT NULL,
+ insert_file_size bigint DEFAULT NULL,
+ delete_file_size bigint DEFAULT NULL,
+ base_file_size bigint DEFAULT NULL,
+ pos_delete_file_size bigint DEFAULT NULL,
+ eq_delete_file_size bigint DEFAULT NULL,
+ source_nodes varchar(2048) DEFAULT NULL,
+ is_delete_pos_delete int DEFAULT NULL,
+ task_plan_group varchar(40) DEFAULT NULL,
+ status varchar(16) DEFAULT NULL,
+ pending_time timestamp DEFAULT NULL,
+ execute_time timestamp DEFAULT NULL,
+ prepared_time timestamp DEFAULT NULL,
+ report_time timestamp DEFAULT NULL,
+ commit_time timestamp DEFAULT NULL,
+ job_type varchar(16) DEFAULT NULL,
+ job_id varchar(32) DEFAULT NULL,
+ attempt_id varchar(40) DEFAULT NULL,
+ retry bigint DEFAULT NULL,
+ fail_reason varchar(4096) DEFAULT NULL,
+ fail_time timestamp DEFAULT NULL,
+ new_file_size bigint DEFAULT NULL,
+ new_file_cnt bigint DEFAULT NULL,
+ cost_time bigint DEFAULT NULL,
+ PRIMARY KEY (trace_id)
+);
+
+CREATE TABLE optimize_table_runtime (
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ table_name varchar(128) NOT NULL,
+ current_snapshot_id bigint NOT NULL DEFAULT -1,
+ latest_major_optimize_time clob(64m),
+ latest_full_optimize_time clob(64m),
+ latest_minor_optimize_time clob(64m),
+ latest_task_plan_group varchar(40) DEFAULT NULL,
+ optimize_status varchar(20) DEFAULT 'Idle',
+ optimize_status_start_time timestamp DEFAULT NULL,
+ current_change_snapshotId bigint DEFAULT NULL,
+ PRIMARY KEY (catalog_name,db_name,table_name)
+);
+
+CREATE TABLE table_metadata (
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ table_name varchar(128) NOT NULL,
+ primary_key varchar(256) DEFAULT NULL,
+ sort_key varchar(256) DEFAULT NULL,
+ table_location varchar(256) DEFAULT NULL,
+ base_location varchar(256) DEFAULT NULL,
+ delta_location varchar(256) DEFAULT NULL,
+ properties clob(64m),
+ meta_store_site clob(64m),
+ hdfs_site clob(64m),
+ core_site clob(64m),
+ hbase_site clob(64m),
+ auth_method varchar(32) DEFAULT NULL,
+ hadoop_username varchar(64) DEFAULT NULL,
+ krb_keytab clob(64m),
+ krb_conf clob(64m),
+ krb_principal clob(64m),
+ current_tx_id bigint DEFAULT 0,
+ cur_schema_id int DEFAULT 0,
+ PRIMARY KEY (catalog_name, db_name, table_name)
+);
+
+CREATE TABLE file_info_cache (
+ primary_key_md5 varchar(64) NOT NULL,
+ table_identifier varchar(384) NOT NULL,
+ add_snapshot_id bigint NOT NULL,
+ parent_snapshot_id bigint NOT NULL,
+ delete_snapshot_id bigint DEFAULT NULL,
+ add_snapshot_sequence bigint NOT NULL DEFAULT -1,
+ inner_table varchar(64) DEFAULT NULL,
+ file_path varchar(400) NOT NULL,
+ file_type varchar(64) DEFAULT NULL,
+ producer varchar(64) NOT NULL DEFAULT 'INGESTION',
+ file_size bigint DEFAULT NULL,
+ file_mask bigint DEFAULT NULL,
+ file_index bigint DEFAULT NULL,
+ spec_id bigint DEFAULT NULL,
+ record_count bigint DEFAULT NULL,
+ partition_name varchar(256) DEFAULT NULL,
+ action varchar(64) DEFAULT NULL,
+ commit_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (primary_key_md5)
+);
+
+CREATE TABLE optimize_file (
+ id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ optimize_type varchar(10) NOT NULL,
+ trace_id varchar(40) NOT NULL,
+ content_type varchar(32) NOT NULL,
+ is_target int DEFAULT 0,
+ file_content blob(60000) DEFAULT NULL,
+ PRIMARY KEY (id)
+);
+
+CREATE TABLE optimize_history (
+ history_id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ table_name varchar(128) NOT NULL,
+ optimize_range varchar(10) NOT NULL,
+ visible_time timestamp DEFAULT NULL,
+ commit_time timestamp DEFAULT NULL,
+ plan_time timestamp DEFAULT NULL,
+ duration bigint DEFAULT NULL,
+ total_file_cnt_before int NOT NULL,
+ total_file_size_before bigint NOT NULL,
+ insert_file_cnt_before int NOT NULL,
+ insert_file_size_before bigint NOT NULL,
+ delete_file_cnt_before int NOT NULL,
+ delete_file_size_before bigint NOT NULL,
+ base_file_cnt_before int NOT NULL,
+ base_file_size_before bigint NOT NULL,
+ pos_delete_file_cnt_before int NOT NULL,
+ pos_delete_file_size_before bigint NOT NULL,
+ eq_delete_file_cnt_before int NOT NULL,
+ eq_delete_file_size_before bigint NOT NULL,
+ total_file_cnt_after int NOT NULL,
+ total_file_size_after bigint NOT NULL,
+ snapshot_id bigint DEFAULT NULL,
+ total_size bigint DEFAULT NULL,
+ added_files int DEFAULT NULL,
+ removed_files int DEFAULT NULL,
+ added_records bigint DEFAULT NULL,
+ removed_records bigint DEFAULT NULL,
+ added_files_size bigint DEFAULT NULL,
+ removed_files_size bigint DEFAULT NULL,
+ total_files bigint DEFAULT NULL,
+ total_records bigint DEFAULT NULL,
+ partition_cnt int NOT NULL,
+ partitions clob(64m),
+ max_change_transaction_id clob(64m),
+ optimize_type varchar(10) NOT NULL,
+ PRIMARY KEY (history_id)
+);
+
+
+CREATE TABLE table_transaction_meta (
+ table_identifier varchar(384) NOT NULL,
+ transaction_id bigint NOT NULL,
+ signature varchar(256) NOT NULL,
+ commit_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (table_identifier, transaction_id),
+ UNIQUE (table_identifier, signature)
+);
+
+CREATE TABLE optimize_task_history (
+ task_trace_id varchar(50) NOT NULL,
+ retry int NOT NULL,
+ task_plan_group varchar(40) NOT NULL,
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ table_name varchar(128) NOT NULL,
+ start_time timestamp DEFAULT NULL,
+ end_time timestamp DEFAULT NULL,
+ cost_time bigint DEFAULT NULL,
+ queue_id int DEFAULT NULL,
+ PRIMARY KEY (task_trace_id, retry)
+);
+
+CREATE TABLE database_metadata (
+ db_id int NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ catalog_name varchar(64) NOT NULL,
+ db_name varchar(128) NOT NULL,
+ PRIMARY KEY (db_id),
+ UNIQUE (catalog_name,db_name)
+);
+
+CREATE TABLE api_tokens (
+ id int NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 33, INCREMENT BY 1),
+ apikey varchar(256) NOT NULL,
+ secret varchar(256) NOT NULL,
+ apply_time timestamp DEFAULT NULL,
+ PRIMARY KEY (id),
+ UNIQUE (apikey)
+);
+
+CREATE TABLE ddl_record
+(
+ table_identifier varchar(384) NOT NULL,
+ ddl clob(64m),
+ ddl_type varchar(256) NOT NULL,
+ commit_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
+);
+
+CREATE TABLE platform_file_info (
+ id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
+ file_name varchar(100) NOT NULL,
+ file_content_b64 clob(64m) NOT NULL,
+ file_path varchar(100) DEFAULT NULL,
+ add_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (id)
+);
+
+INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/arctic/warehouse","table-formats":"ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
+INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('iceberg','hive','{"storage.type":"hdfs","hive.site":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLQogIH4gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZSBvciBtb3JlCiAgfiBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlIGRpc3RyaWJ1dGVkIHdpdGgKICB+IHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiByZWdhcmRpbmcgY29weXJpZ2h0IG93bmVyc2hpcC4KICB+IFRoZSBBU0YgbGljZW5zZXMgdGhpcyBmaWxlIHRvIFlvdSB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wCiAgfiAodGhlICJMaWNlbnNlIik7IHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aAogIH4gdGhlIExpY2Vuc2UuICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKICB+CiAgfiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAgfgogIH4gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQogIH4gZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKICB+IFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgogIH4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAogIH4gbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCiAgLS0+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9ImNvbmZpZ3VyYXRpb24ueHNsIj8+Cjxjb25maWd1cmF0aW9uPgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVSTDwvbmFtZT4KICAgICAgICA8dmFsdWU+amRiYzpteXNxbDovL215c3FsOjMzMDYvbWV0YXN0b3JlP3VzZVNTTD1mYWxzZSZhbXA7YWxsb3dQdWJsaWNLZXlSZXRyaWV2YWw9dHJ1ZTwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvbkRyaXZlck5hbWU8L25hbWU+CiAgICAgICAgPHZhbHVlPmNvbS5teXNxbC5qZGJjLkRyaXZlcjwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVzZXJOYW1lPC9uYW1lPgogICAgICAgIDx2YWx1ZT5yb290PC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+amF2YXguamRvLm9wdGlvbi5Db25uZWN0aW9uUGFzc3dvcmQ8L25hbWU+CiAgICAgICAgPHZhbHVlPnBhc3N3b3JkPC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+aGl2ZS5tZXRhc3RvcmUud2FyZWhvdXNlLmRpcjwvbmFtZT4KICAgICAgICA8dmFsdWU+L3RtcC9oaXZlL3dhcmVob3VzZTwvdmFsdWU+CiAgICAgICAgPGRlc2NyaXB0aW9uPmxvY2F0aW9uIG9mIGRlZmF1bHQgZGF0YWJhc2UgZm9yIHRoZSB3YXJlaG91c2U8L2Rlc2NyaXB0aW9uPgogICAgPC9wcm9wZXJ0eT4KICAgIDxwcm9wZXJ0eT4KICAgICAgICA8bmFtZT5oaXZlLm1ldGFzdG9yZS51cmlzPC9uYW1lPgogICAgICAgIDx2YWx1ZT50aHJpZnQ6Ly9tZXRhc3RvcmU6OTA4MzwvdmFsdWU+CiAgICA8L3Byb3BlcnR5Pgo8L2NvbmZpZ3VyYXRpb24+","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/hive/warehouse","table-formats":"ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
\ No newline at end of file
diff --git a/docker/benchmark/images/ams-config/config.sh b/docker/benchmark/images/ams-config/config.sh
new file mode 100644
index 00000000..72af313e
--- /dev/null
+++ b/docker/benchmark/images/ams-config/config.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+XMX_CONFIG="2048"
+XMS_CONFIG="2048"
+MAX_PERM_CONFIG="128"
+JMX_REMOTE_PORT_CONFIG=""
+JVM_EXTRA_CONFIG="-XX:NewRatio=1 -XX:SurvivorRatio=3"
+LANG_CONFIG="en_US.UTF-8"
diff --git a/docker/benchmark/images/benchmark-config/presto_hudi_config.xml b/docker/benchmark/images/benchmark-config/presto_hudi_config.xml
index da4dd3c6..c6cdcfda 100644
--- a/docker/benchmark/images/benchmark-config/presto_hudi_config.xml
+++ b/docker/benchmark/images/benchmark-config/presto_hudi_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-config/sample_chbenchmark_config.xml b/docker/benchmark/images/benchmark-config/sample_chbenchmark_config.xml
index b0ee2bcf..3b1be26b 100644
--- a/docker/benchmark/images/benchmark-config/sample_chbenchmark_config.xml
+++ b/docker/benchmark/images/benchmark-config/sample_chbenchmark_config.xml
@@ -29,7 +29,7 @@
-
+
unlimited
diff --git a/docker/benchmark/images/benchmark-config/spark_arctic_config.xml b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
index 3f0678b0..cf51b5a0 100644
--- a/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
+++ b/docker/benchmark/images/benchmark-config/spark_arctic_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-config/spark_hudi_config.xml b/docker/benchmark/images/benchmark-config/spark_hudi_config.xml
index 3d23b5c5..b3069f53 100644
--- a/docker/benchmark/images/benchmark-config/spark_hudi_config.xml
+++ b/docker/benchmark/images/benchmark-config/spark_hudi_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
index 7fbcfa37..59988949 100644
--- a/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
+++ b/docker/benchmark/images/benchmark-config/spark_iceberg_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-config/trino_arctic_config.xml b/docker/benchmark/images/benchmark-config/trino_arctic_config.xml
index f3ac6e21..9157efce 100644
--- a/docker/benchmark/images/benchmark-config/trino_arctic_config.xml
+++ b/docker/benchmark/images/benchmark-config/trino_arctic_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-config/trino_iceberg_config.xml b/docker/benchmark/images/benchmark-config/trino_iceberg_config.xml
index 55f57f6d..2e2826e5 100644
--- a/docker/benchmark/images/benchmark-config/trino_iceberg_config.xml
+++ b/docker/benchmark/images/benchmark-config/trino_iceberg_config.xml
@@ -30,7 +30,7 @@
-
+
200
diff --git a/docker/benchmark/images/benchmark-spark.Dockerfile b/docker/benchmark/images/benchmark-spark.Dockerfile
index b91eb9d4..3925fb52 100644
--- a/docker/benchmark/images/benchmark-spark.Dockerfile
+++ b/docker/benchmark/images/benchmark-spark.Dockerfile
@@ -25,8 +25,7 @@ RUN wget ${APACHE_MIRROR}/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bi
RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/arctic-spark_3.1-runtime-${ARCTIC_VERSION}.jar -P ${SPARK_HOME}/jars && \
wget https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}/1.0.0/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}-1.0.0.jar -P ${SPARK_HOME}/jars && \
- wget https://repo1.maven.org/maven2/org/apache/hudi/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}/0.12.1/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}-0.12.1.jar -P ${SPARK_HOME}/jars && \
- wget https://repo1.maven.org/maven2/io/delta/delta-core_${SCALA_BINARY_VERSION}/1.0.0/delta-core_${SCALA_BINARY_VERSION}-1.0.0.jar -P ${SPARK_HOME}/jars
+ wget https://repo1.maven.org/maven2/org/apache/hudi/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}/0.11.1/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}-0.11.1.jar -P ${SPARK_HOME}/jars
RUN mkdir -p -m 777 /tmp/hive
RUN mkdir -p -m 777 /tmp/arctic
From b60b09c0e52cdbab977f6799b7f823890bc0ee03 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Fri, 2 Dec 2022 16:48:30 +0800
Subject: [PATCH 15/18] change init sql
---
docker/benchmark/images/ams-config/ams-init.sql | 2 +-
docker/benchmark/images/benchmark-spark.Dockerfile | 5 +----
2 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/docker/benchmark/images/ams-config/ams-init.sql b/docker/benchmark/images/ams-config/ams-init.sql
index 44a65080..82568063 100644
--- a/docker/benchmark/images/ams-config/ams-init.sql
+++ b/docker/benchmark/images/ams-config/ams-init.sql
@@ -270,5 +270,5 @@ CREATE TABLE platform_file_info (
PRIMARY KEY (id)
);
-INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/arctic/warehouse","table-formats":"ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
+INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/arctic/warehouse","table-formats":"MIXED_ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('iceberg','hive','{"storage.type":"hdfs","hive.site":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLQogIH4gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZSBvciBtb3JlCiAgfiBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlIGRpc3RyaWJ1dGVkIHdpdGgKICB+IHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiByZWdhcmRpbmcgY29weXJpZ2h0IG93bmVyc2hpcC4KICB+IFRoZSBBU0YgbGljZW5zZXMgdGhpcyBmaWxlIHRvIFlvdSB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wCiAgfiAodGhlICJMaWNlbnNlIik7IHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aAogIH4gdGhlIExpY2Vuc2UuICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKICB+CiAgfiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAgfgogIH4gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQogIH4gZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKICB+IFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgogIH4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAogIH4gbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCiAgLS0+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9ImNvbmZpZ3VyYXRpb24ueHNsIj8+Cjxjb25maWd1cmF0aW9uPgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVSTDwvbmFtZT4KICAgICAgICA8dmFsdWU+amRiYzpteXNxbDovL215c3FsOjMzMDYvbWV0YXN0b3JlP3VzZVNTTD1mYWxzZSZhbXA7YWxsb3dQdWJsaWNLZXlSZXRyaWV2YWw9dHJ1ZTwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvbkRyaXZlck5hbWU8L25hbWU+CiAgICAgICAgPHZhbHVlPmNvbS5teXNxbC5qZGJjLkRyaXZlcjwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVzZXJOYW1lPC9uYW1lPgogICAgICAgIDx2YWx1ZT5yb290PC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+amF2YXguamRvLm9wdGlvbi5Db25uZWN0aW9uUGFzc3dvcmQ8L25hbWU+CiAgICAgICAgPHZhbHVlPnBhc3N3b3JkPC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+aGl2ZS5tZXRhc3RvcmUud2FyZWhvdXNlLmRpcjwvbmFtZT4KICAgICAgICA8dmFsdWU+L3RtcC9oaXZlL3dhcmVob3VzZTwvdmFsdWU+CiAgICAgICAgPGRlc2NyaXB0aW9uPmxvY2F0aW9uIG9mIGRlZmF1bHQgZGF0YWJhc2UgZm9yIHRoZSB3YXJlaG91c2U8L2Rlc2NyaXB0aW9uPgogICAgPC9wcm9wZXJ0eT4KICAgIDxwcm9wZXJ0eT4KICAgICAgICA8bmFtZT5oaXZlLm1ldGFzdG9yZS51cmlzPC9uYW1lPgogICAgICAgIDx2YWx1ZT50aHJpZnQ6Ly9tZXRhc3RvcmU6OTA4MzwvdmFsdWU+CiAgICA8L3Byb3BlcnR5Pgo8L2NvbmZpZ3VyYXRpb24+","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/hive/warehouse","table-formats":"ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-spark.Dockerfile b/docker/benchmark/images/benchmark-spark.Dockerfile
index 3925fb52..ae85ddab 100644
--- a/docker/benchmark/images/benchmark-spark.Dockerfile
+++ b/docker/benchmark/images/benchmark-spark.Dockerfile
@@ -12,9 +12,6 @@ ARG SCALA_BINARY_VERSION
ENV SPARK_HOME=/opt/spark
RUN apt update && \
- apt-get install -y vim && \
- apt-get install -y net-tools && \
- apt-get install -y telnet && \
apt-get install -y default-mysql-client && \
apt-get clean
@@ -23,7 +20,7 @@ RUN wget ${APACHE_MIRROR}/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bi
ln -s /opt/spark-${SPARK_VERSION}-bin-hadoop3.2 ${SPARK_HOME} && \
rm spark-${SPARK_VERSION}-bin-hadoop3.2.tgz
-RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/arctic-spark_3.1-runtime-${ARCTIC_VERSION}.jar -P ${SPARK_HOME}/jars && \
+RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/arctic-spark-3.1-runtime-${ARCTIC_VERSION}.jar -P ${SPARK_HOME}/jars && \
wget https://repo1.maven.org/maven2/org/apache/iceberg/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}/1.0.0/iceberg-spark-runtime-${SPARK_BINARY_VERSION}_${SCALA_BINARY_VERSION}-1.0.0.jar -P ${SPARK_HOME}/jars && \
wget https://repo1.maven.org/maven2/org/apache/hudi/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}/0.11.1/hudi-spark${SPARK_BINARY_VERSION}-bundle_${SCALA_BINARY_VERSION}-0.11.1.jar -P ${SPARK_HOME}/jars
From 274608b892c152a16cc0762790d4f77424b885b8 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Mon, 5 Dec 2022 19:34:54 +0800
Subject: [PATCH 16/18] add wait-for-it.sh to waite for service which depends
on other service.
---
docker/benchmark/docker-compose.yml | 2 +
.../benchmark/images/ams-config/ams-init.sql | 10 +-
.../images/benchmark-metastore.Dockerfile | 3 +-
.../images/benchmark-spark.Dockerfile | 10 +-
.../scripts/benchmark-spark-entrypoint.sh | 15 --
.../benchmark/images/scripts/wait-for-it.sh | 182 ++++++++++++++++++
6 files changed, 191 insertions(+), 31 deletions(-)
delete mode 100644 docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
create mode 100644 docker/benchmark/images/scripts/wait-for-it.sh
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index 822af7b4..11fc7add 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -27,6 +27,7 @@ services:
- ./images/hive-config/core-site.xml:/etc/hadoop/conf/core-site.xml
- ./images/hive-config/hive-site.xml:/etc/hive/conf/hive-site.xml
- ./hive:/tmp/hive/warehouse
+ command: ["./wait-for-it.sh", "mysql:3306", "--strict", "--", "/opt/hive/bin/hive", "--service", "metastore"]
depends_on:
- mysql
@@ -87,6 +88,7 @@ services:
- ./arctic:/tmp/arctic/warehouse
- ./images/hive-config/hive-site.xml:/opt/spark/conf/hive-site.xml
- ./images/spark-config/spark-defaults.conf:/opt/spark/conf/spark-defaults.conf
+ command: ["./wait-for-it.sh", "metastore:9083", "--strict", "--", "bash", "-c", "/opt/spark/sbin/start-thriftserver.sh && tail -f /dev/null"]
ports:
- 10000:10000
depends_on:
diff --git a/docker/benchmark/images/ams-config/ams-init.sql b/docker/benchmark/images/ams-config/ams-init.sql
index 82568063..dc298e3c 100644
--- a/docker/benchmark/images/ams-config/ams-init.sql
+++ b/docker/benchmark/images/ams-config/ams-init.sql
@@ -73,12 +73,10 @@ CREATE TABLE optimize_task (
delete_files bigint DEFAULT NULL,
base_files bigint DEFAULT NULL,
pos_delete_files bigint DEFAULT NULL,
- eq_delete_files bigint DEFAULT NULL,
insert_file_size bigint DEFAULT NULL,
delete_file_size bigint DEFAULT NULL,
base_file_size bigint DEFAULT NULL,
pos_delete_file_size bigint DEFAULT NULL,
- eq_delete_file_size bigint DEFAULT NULL,
source_nodes varchar(2048) DEFAULT NULL,
is_delete_pos_delete int DEFAULT NULL,
task_plan_group varchar(40) DEFAULT NULL,
@@ -191,8 +189,6 @@ CREATE TABLE optimize_history (
base_file_size_before bigint NOT NULL,
pos_delete_file_cnt_before int NOT NULL,
pos_delete_file_size_before bigint NOT NULL,
- eq_delete_file_cnt_before int NOT NULL,
- eq_delete_file_size_before bigint NOT NULL,
total_file_cnt_after int NOT NULL,
total_file_size_after bigint NOT NULL,
snapshot_id bigint DEFAULT NULL,
@@ -264,11 +260,11 @@ CREATE TABLE ddl_record
CREATE TABLE platform_file_info (
id bigint NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),
file_name varchar(100) NOT NULL,
- file_content_b64 clob(64m) NOT NULL,
+ file_content_b64 varchar(32672) NOT NULL,
file_path varchar(100) DEFAULT NULL,
add_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (id)
);
-INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/arctic/warehouse","table-formats":"MIXED_ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
-INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('iceberg','hive','{"storage.type":"hdfs","hive.site":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLQogIH4gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZSBvciBtb3JlCiAgfiBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlIGRpc3RyaWJ1dGVkIHdpdGgKICB+IHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiByZWdhcmRpbmcgY29weXJpZ2h0IG93bmVyc2hpcC4KICB+IFRoZSBBU0YgbGljZW5zZXMgdGhpcyBmaWxlIHRvIFlvdSB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wCiAgfiAodGhlICJMaWNlbnNlIik7IHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aAogIH4gdGhlIExpY2Vuc2UuICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKICB+CiAgfiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAgfgogIH4gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQogIH4gZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKICB+IFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgogIH4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAogIH4gbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCiAgLS0+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9ImNvbmZpZ3VyYXRpb24ueHNsIj8+Cjxjb25maWd1cmF0aW9uPgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVSTDwvbmFtZT4KICAgICAgICA8dmFsdWU+amRiYzpteXNxbDovL215c3FsOjMzMDYvbWV0YXN0b3JlP3VzZVNTTD1mYWxzZSZhbXA7YWxsb3dQdWJsaWNLZXlSZXRyaWV2YWw9dHJ1ZTwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvbkRyaXZlck5hbWU8L25hbWU+CiAgICAgICAgPHZhbHVlPmNvbS5teXNxbC5qZGJjLkRyaXZlcjwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVzZXJOYW1lPC9uYW1lPgogICAgICAgIDx2YWx1ZT5yb290PC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+amF2YXguamRvLm9wdGlvbi5Db25uZWN0aW9uUGFzc3dvcmQ8L25hbWU+CiAgICAgICAgPHZhbHVlPnBhc3N3b3JkPC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+aGl2ZS5tZXRhc3RvcmUud2FyZWhvdXNlLmRpcjwvbmFtZT4KICAgICAgICA8dmFsdWU+L3RtcC9oaXZlL3dhcmVob3VzZTwvdmFsdWU+CiAgICAgICAgPGRlc2NyaXB0aW9uPmxvY2F0aW9uIG9mIGRlZmF1bHQgZGF0YWJhc2UgZm9yIHRoZSB3YXJlaG91c2U8L2Rlc2NyaXB0aW9uPgogICAgPC9wcm9wZXJ0eT4KICAgIDxwcm9wZXJ0eT4KICAgICAgICA8bmFtZT5oaXZlLm1ldGFzdG9yZS51cmlzPC9uYW1lPgogICAgICAgIDx2YWx1ZT50aHJpZnQ6Ly9tZXRhc3RvcmU6OTA4MzwvdmFsdWU+CiAgICA8L3Byb3BlcnR5Pgo8L2NvbmZpZ3VyYXRpb24+","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse.dir":"/tmp/hive/warehouse","table-formats":"ICEBERG","table.optimize.enable":"true","table.optimize.group":"default"}');
\ No newline at end of file
+INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('local_catalog','ams','{"storage.type":"hdfs","hive.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse":"/tmp/arctic/warehouse","table-formats":"MIXED_ICEBERG"}');
+INSERT INTO catalog_metadata(catalog_name,catalog_type,storage_configs,auth_configs, catalog_properties) VALUES ('iceberg','hive','{"storage.type":"hdfs","hive.site":"PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCEtLQogIH4gTGljZW5zZWQgdG8gdGhlIEFwYWNoZSBTb2Z0d2FyZSBGb3VuZGF0aW9uIChBU0YpIHVuZGVyIG9uZSBvciBtb3JlCiAgfiBjb250cmlidXRvciBsaWNlbnNlIGFncmVlbWVudHMuICBTZWUgdGhlIE5PVElDRSBmaWxlIGRpc3RyaWJ1dGVkIHdpdGgKICB+IHRoaXMgd29yayBmb3IgYWRkaXRpb25hbCBpbmZvcm1hdGlvbiByZWdhcmRpbmcgY29weXJpZ2h0IG93bmVyc2hpcC4KICB+IFRoZSBBU0YgbGljZW5zZXMgdGhpcyBmaWxlIHRvIFlvdSB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wCiAgfiAodGhlICJMaWNlbnNlIik7IHlvdSBtYXkgbm90IHVzZSB0aGlzIGZpbGUgZXhjZXB0IGluIGNvbXBsaWFuY2Ugd2l0aAogIH4gdGhlIExpY2Vuc2UuICBZb3UgbWF5IG9idGFpbiBhIGNvcHkgb2YgdGhlIExpY2Vuc2UgYXQKICB+CiAgfiAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0xJQ0VOU0UtMi4wCiAgfgogIH4gVW5sZXNzIHJlcXVpcmVkIGJ5IGFwcGxpY2FibGUgbGF3IG9yIGFncmVlZCB0byBpbiB3cml0aW5nLCBzb2Z0d2FyZQogIH4gZGlzdHJpYnV0ZWQgdW5kZXIgdGhlIExpY2Vuc2UgaXMgZGlzdHJpYnV0ZWQgb24gYW4gIkFTIElTIiBCQVNJUywKICB+IFdJVEhPVVQgV0FSUkFOVElFUyBPUiBDT05ESVRJT05TIE9GIEFOWSBLSU5ELCBlaXRoZXIgZXhwcmVzcyBvciBpbXBsaWVkLgogIH4gU2VlIHRoZSBMaWNlbnNlIGZvciB0aGUgc3BlY2lmaWMgbGFuZ3VhZ2UgZ292ZXJuaW5nIHBlcm1pc3Npb25zIGFuZAogIH4gbGltaXRhdGlvbnMgdW5kZXIgdGhlIExpY2Vuc2UuCiAgLS0+Cjw/eG1sLXN0eWxlc2hlZXQgdHlwZT0idGV4dC94c2wiIGhyZWY9ImNvbmZpZ3VyYXRpb24ueHNsIj8+Cjxjb25maWd1cmF0aW9uPgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVSTDwvbmFtZT4KICAgICAgICA8dmFsdWU+amRiYzpteXNxbDovL215c3FsOjMzMDYvbWV0YXN0b3JlP3VzZVNTTD1mYWxzZSZhbXA7YWxsb3dQdWJsaWNLZXlSZXRyaWV2YWw9dHJ1ZTwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvbkRyaXZlck5hbWU8L25hbWU+CiAgICAgICAgPHZhbHVlPmNvbS5teXNxbC5qZGJjLkRyaXZlcjwvdmFsdWU+CiAgICA8L3Byb3BlcnR5PgogICAgPHByb3BlcnR5PgogICAgICAgIDxuYW1lPmphdmF4Lmpkby5vcHRpb24uQ29ubmVjdGlvblVzZXJOYW1lPC9uYW1lPgogICAgICAgIDx2YWx1ZT5yb290PC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+amF2YXguamRvLm9wdGlvbi5Db25uZWN0aW9uUGFzc3dvcmQ8L25hbWU+CiAgICAgICAgPHZhbHVlPnBhc3N3b3JkPC92YWx1ZT4KICAgIDwvcHJvcGVydHk+CiAgICA8cHJvcGVydHk+CiAgICAgICAgPG5hbWU+aGl2ZS5tZXRhc3RvcmUud2FyZWhvdXNlLmRpcjwvbmFtZT4KICAgICAgICA8dmFsdWU+L3RtcC9oaXZlL3dhcmVob3VzZTwvdmFsdWU+CiAgICAgICAgPGRlc2NyaXB0aW9uPmxvY2F0aW9uIG9mIGRlZmF1bHQgZGF0YWJhc2UgZm9yIHRoZSB3YXJlaG91c2U8L2Rlc2NyaXB0aW9uPgogICAgPC9wcm9wZXJ0eT4KICAgIDxwcm9wZXJ0eT4KICAgICAgICA8bmFtZT5oaXZlLm1ldGFzdG9yZS51cmlzPC9uYW1lPgogICAgICAgIDx2YWx1ZT50aHJpZnQ6Ly9tZXRhc3RvcmU6OTA4MzwvdmFsdWU+CiAgICA8L3Byb3BlcnR5Pgo8L2NvbmZpZ3VyYXRpb24+","hadoop.core.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg==","hadoop.hdfs.site":"PGNvbmZpZ3VyYXRpb24+PC9jb25maWd1cmF0aW9uPg=="}','{"auth.type":"simple","auth.simple.hadoop_username":"root"}','{"warehouse":"/tmp/hive/warehouse","table-formats":"ICEBERG","table.self-optimizing.enabled":"true","table.self-optimizing.group":"default"}');
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-metastore.Dockerfile b/docker/benchmark/images/benchmark-metastore.Dockerfile
index 790efc23..ad837304 100644
--- a/docker/benchmark/images/benchmark-metastore.Dockerfile
+++ b/docker/benchmark/images/benchmark-metastore.Dockerfile
@@ -32,4 +32,5 @@ RUN set -x && \
mkdir ${HIVE_HOME}/auxlib && \
wget -q https://github.com/NetEase/lakehouse-benchmark-ingestion/releases/download/1.0/hudi-hadoop-mr-bundle-0.11.1.jar -P ${HIVE_HOME}/auxlib
-ENTRYPOINT ["/opt/hive/bin/hive", "--service", "metastore"]
+COPY scripts/wait-for-it.sh /
+RUN chmod a+x /wait-for-it.sh
diff --git a/docker/benchmark/images/benchmark-spark.Dockerfile b/docker/benchmark/images/benchmark-spark.Dockerfile
index ae85ddab..90504106 100644
--- a/docker/benchmark/images/benchmark-spark.Dockerfile
+++ b/docker/benchmark/images/benchmark-spark.Dockerfile
@@ -11,10 +11,6 @@ ARG SCALA_BINARY_VERSION
ENV SPARK_HOME=/opt/spark
-RUN apt update && \
- apt-get install -y default-mysql-client && \
- apt-get clean
-
RUN wget ${APACHE_MIRROR}/spark/spark-${SPARK_VERSION}/spark-${SPARK_VERSION}-bin-hadoop3.2.tgz && \
tar -xzf spark-${SPARK_VERSION}-bin-hadoop3.2.tgz -C /opt && \
ln -s /opt/spark-${SPARK_VERSION}-bin-hadoop3.2 ${SPARK_HOME} && \
@@ -26,10 +22,8 @@ RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/a
RUN mkdir -p -m 777 /tmp/hive
RUN mkdir -p -m 777 /tmp/arctic
-WORKDIR ${SPARK_HOME}
-COPY scripts/benchmark-spark-entrypoint.sh ${SPARK_HOME}
-RUN chmod a+x ${SPARK_HOME}/benchmark-spark-entrypoint.sh
-CMD ["bash","-c","/opt/spark/benchmark-spark-entrypoint.sh && tail -f /dev/null"]
+COPY scripts/wait-for-it.sh /
+RUN chmod a+x /wait-for-it.sh
diff --git a/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh b/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
deleted file mode 100644
index 003a963d..00000000
--- a/docker/benchmark/images/scripts/benchmark-spark-entrypoint.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/bash
-
-SQL_RESULT=""
-while [[ "${SQL_RESULT}" != 1 ]]
-do
- echo "Wait for table initialization to complete..."
- sleep 1
- SQL_RESULT=$(mysql -h mysql -P 3306 --database=metastore \
- --user="${MYSQL_USER}" --password="${MYSQL_PASSWORD}" \
- --execute="select VER_ID from VERSION;" \
- -s -N)
-done
-echo "MySQL initialization is successful, starting Spark Thrift Server..."
-
-sbin/start-thriftserver.sh
\ No newline at end of file
diff --git a/docker/benchmark/images/scripts/wait-for-it.sh b/docker/benchmark/images/scripts/wait-for-it.sh
new file mode 100644
index 00000000..68130563
--- /dev/null
+++ b/docker/benchmark/images/scripts/wait-for-it.sh
@@ -0,0 +1,182 @@
+#!/usr/bin/env bash
+# Use this script to test if a given TCP host/port are available
+
+WAITFORIT_cmdname=${0##*/}
+
+echoerr() { if [[ $WAITFORIT_QUIET -ne 1 ]]; then echo "$@" 1>&2; fi }
+
+usage()
+{
+ cat << USAGE >&2
+Usage:
+ $WAITFORIT_cmdname host:port [-s] [-t timeout] [-- command args]
+ -h HOST | --host=HOST Host or IP under test
+ -p PORT | --port=PORT TCP port under test
+ Alternatively, you specify the host and port as host:port
+ -s | --strict Only execute subcommand if the test succeeds
+ -q | --quiet Don't output any status messages
+ -t TIMEOUT | --timeout=TIMEOUT
+ Timeout in seconds, zero for no timeout
+ -- COMMAND ARGS Execute command with args after the test finishes
+USAGE
+ exit 1
+}
+
+wait_for()
+{
+ if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
+ echoerr "$WAITFORIT_cmdname: waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
+ else
+ echoerr "$WAITFORIT_cmdname: waiting for $WAITFORIT_HOST:$WAITFORIT_PORT without a timeout"
+ fi
+ WAITFORIT_start_ts=$(date +%s)
+ while :
+ do
+ if [[ $WAITFORIT_ISBUSY -eq 1 ]]; then
+ nc -z $WAITFORIT_HOST $WAITFORIT_PORT
+ WAITFORIT_result=$?
+ else
+ (echo -n > /dev/tcp/$WAITFORIT_HOST/$WAITFORIT_PORT) >/dev/null 2>&1
+ WAITFORIT_result=$?
+ fi
+ if [[ $WAITFORIT_result -eq 0 ]]; then
+ WAITFORIT_end_ts=$(date +%s)
+ echoerr "$WAITFORIT_cmdname: $WAITFORIT_HOST:$WAITFORIT_PORT is available after $((WAITFORIT_end_ts - WAITFORIT_start_ts)) seconds"
+ break
+ fi
+ sleep 1
+ done
+ return $WAITFORIT_result
+}
+
+wait_for_wrapper()
+{
+ # In order to support SIGINT during timeout: http://unix.stackexchange.com/a/57692
+ if [[ $WAITFORIT_QUIET -eq 1 ]]; then
+ timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --quiet --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
+ else
+ timeout $WAITFORIT_BUSYTIMEFLAG $WAITFORIT_TIMEOUT $0 --child --host=$WAITFORIT_HOST --port=$WAITFORIT_PORT --timeout=$WAITFORIT_TIMEOUT &
+ fi
+ WAITFORIT_PID=$!
+ trap "kill -INT -$WAITFORIT_PID" INT
+ wait $WAITFORIT_PID
+ WAITFORIT_RESULT=$?
+ if [[ $WAITFORIT_RESULT -ne 0 ]]; then
+ echoerr "$WAITFORIT_cmdname: timeout occurred after waiting $WAITFORIT_TIMEOUT seconds for $WAITFORIT_HOST:$WAITFORIT_PORT"
+ fi
+ return $WAITFORIT_RESULT
+}
+
+# process arguments
+while [[ $# -gt 0 ]]
+do
+ case "$1" in
+ *:* )
+ WAITFORIT_hostport=(${1//:/ })
+ WAITFORIT_HOST=${WAITFORIT_hostport[0]}
+ WAITFORIT_PORT=${WAITFORIT_hostport[1]}
+ shift 1
+ ;;
+ --child)
+ WAITFORIT_CHILD=1
+ shift 1
+ ;;
+ -q | --quiet)
+ WAITFORIT_QUIET=1
+ shift 1
+ ;;
+ -s | --strict)
+ WAITFORIT_STRICT=1
+ shift 1
+ ;;
+ -h)
+ WAITFORIT_HOST="$2"
+ if [[ $WAITFORIT_HOST == "" ]]; then break; fi
+ shift 2
+ ;;
+ --host=*)
+ WAITFORIT_HOST="${1#*=}"
+ shift 1
+ ;;
+ -p)
+ WAITFORIT_PORT="$2"
+ if [[ $WAITFORIT_PORT == "" ]]; then break; fi
+ shift 2
+ ;;
+ --port=*)
+ WAITFORIT_PORT="${1#*=}"
+ shift 1
+ ;;
+ -t)
+ WAITFORIT_TIMEOUT="$2"
+ if [[ $WAITFORIT_TIMEOUT == "" ]]; then break; fi
+ shift 2
+ ;;
+ --timeout=*)
+ WAITFORIT_TIMEOUT="${1#*=}"
+ shift 1
+ ;;
+ --)
+ shift
+ WAITFORIT_CLI=("$@")
+ break
+ ;;
+ --help)
+ usage
+ ;;
+ *)
+ echoerr "Unknown argument: $1"
+ usage
+ ;;
+ esac
+done
+
+if [[ "$WAITFORIT_HOST" == "" || "$WAITFORIT_PORT" == "" ]]; then
+ echoerr "Error: you need to provide a host and port to test."
+ usage
+fi
+
+WAITFORIT_TIMEOUT=${WAITFORIT_TIMEOUT:-180}
+WAITFORIT_STRICT=${WAITFORIT_STRICT:-0}
+WAITFORIT_CHILD=${WAITFORIT_CHILD:-0}
+WAITFORIT_QUIET=${WAITFORIT_QUIET:-0}
+
+# Check to see if timeout is from busybox?
+WAITFORIT_TIMEOUT_PATH=$(type -p timeout)
+WAITFORIT_TIMEOUT_PATH=$(realpath $WAITFORIT_TIMEOUT_PATH 2>/dev/null || readlink -f $WAITFORIT_TIMEOUT_PATH)
+
+WAITFORIT_BUSYTIMEFLAG=""
+if [[ $WAITFORIT_TIMEOUT_PATH =~ "busybox" ]]; then
+ WAITFORIT_ISBUSY=1
+ # Check if busybox timeout uses -t flag
+ # (recent Alpine versions don't support -t anymore)
+ if timeout &>/dev/stdout | grep -q -e '-t '; then
+ WAITFORIT_BUSYTIMEFLAG="-t"
+ fi
+else
+ WAITFORIT_ISBUSY=0
+fi
+
+if [[ $WAITFORIT_CHILD -gt 0 ]]; then
+ wait_for
+ WAITFORIT_RESULT=$?
+ exit $WAITFORIT_RESULT
+else
+ if [[ $WAITFORIT_TIMEOUT -gt 0 ]]; then
+ wait_for_wrapper
+ WAITFORIT_RESULT=$?
+ else
+ wait_for
+ WAITFORIT_RESULT=$?
+ fi
+fi
+
+if [[ $WAITFORIT_CLI != "" ]]; then
+ if [[ $WAITFORIT_RESULT -ne 0 && $WAITFORIT_STRICT -eq 1 ]]; then
+ echoerr "$WAITFORIT_cmdname: strict mode, refusing to execute subprocess"
+ exit $WAITFORIT_RESULT
+ fi
+ exec "${WAITFORIT_CLI[@]}"
+else
+ exit $WAITFORIT_RESULT
+fi
From c49f919b17d5122a2bf763317a6f50b7ba699172 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Mon, 5 Dec 2022 20:34:47 +0800
Subject: [PATCH 17/18] add wait-for-it.sh to waite for service which depends
on other service.
---
docker/benchmark/docker-compose.yml | 2 ++
docker/benchmark/images/benchmark-presto.Dockerfile | 6 +++++-
docker/benchmark/images/benchmark-trino.Dockerfile | 6 +++++-
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/docker/benchmark/docker-compose.yml b/docker/benchmark/docker-compose.yml
index 11fc7add..74f5cd6a 100644
--- a/docker/benchmark/docker-compose.yml
+++ b/docker/benchmark/docker-compose.yml
@@ -57,6 +57,7 @@ services:
- ./images/trino-presto-config/local_catalog.properties:/etc/trino/catalog/local_catalog.properties
- ./images/trino-presto-config/iceberg.properties:/etc/trino/catalog/iceberg.properties
- ./images/trino-presto-config/delta-lake.properties:/etc/trino/catalog/delta-lake.properties
+ command: ["./wait-for-it.sh", "metastore:9083", "--strict", "--", "/usr/lib/trino/bin/run-trino"]
ports:
- 9001:8080
depends_on:
@@ -70,6 +71,7 @@ services:
volumes:
- ./hive:/tmp/hive/warehouse
- ./images/trino-presto-config/hudi.properties:/opt/presto-server/etc/catalog/hudi.properties
+ command: ["./wait-for-it.sh", "metastore:9083", "--strict", "--", "/bin/sh", "-c", "./bin/launcher"]
ports:
- 9002:8080
depends_on:
diff --git a/docker/benchmark/images/benchmark-presto.Dockerfile b/docker/benchmark/images/benchmark-presto.Dockerfile
index ba69ae93..5c5583ea 100644
--- a/docker/benchmark/images/benchmark-presto.Dockerfile
+++ b/docker/benchmark/images/benchmark-presto.Dockerfile
@@ -8,4 +8,8 @@ WORKDIR /opt/presto-server/plugin/hive-hadoop2
COPY ./trino-presto-config/presto-hive-0.274.1-SNAPSHOT.jar ./
-RUN rm presto-hive-${PRESTO_VERSION}.jar
\ No newline at end of file
+RUN rm presto-hive-${PRESTO_VERSION}.jar
+
+WORKDIR /
+COPY scripts/wait-for-it.sh /
+RUN chmod a+x ./wait-for-it.sh
\ No newline at end of file
diff --git a/docker/benchmark/images/benchmark-trino.Dockerfile b/docker/benchmark/images/benchmark-trino.Dockerfile
index fc61bf35..6392a23f 100644
--- a/docker/benchmark/images/benchmark-trino.Dockerfile
+++ b/docker/benchmark/images/benchmark-trino.Dockerfile
@@ -25,4 +25,8 @@ RUN wget https://github.com/NetEase/arctic/releases/download/${ARCTIC_RELEASE}/t
&& tar -zxvf trino-arctic-${ARCTIC_VERSION}.tar.gz \
&& rm -f trino-arctic-${ARCTIC_VERSION}.tar.gz \
&& mv trino-arctic-${ARCTIC_VERSION}/lib/* . \
- && rm -rf trino-arctic-${ARCTIC_VERSION}
\ No newline at end of file
+ && rm -rf trino-arctic-${ARCTIC_VERSION}
+
+WORKDIR /
+COPY scripts/wait-for-it.sh /
+RUN chmod a+x ./wait-for-it.sh
\ No newline at end of file
From 9ae3a221ec1d0e8e0b051a75a14d65f9cbeeca03 Mon Sep 17 00:00:00 2001
From: huangjianmin <531493269@qq.com>
Date: Mon, 20 Feb 2023 09:57:46 +0800
Subject: [PATCH 18/18] add CHBenchmark for doris
---
config/doris/sample_chbenchmark_config.xml | 140 ++++++++
config/plugin.xml | 1 +
.../chbenchmark4doirs/CHBenCHmark.java | 61 ++++
.../chbenchmark4doirs/CHBenCHmarkLoader.java | 328 ++++++++++++++++++
.../chbenchmark4doirs/CHBenCHmarkWorker.java | 47 +++
.../chbenchmark4doirs/pojo/Nation.java | 39 +++
.../chbenchmark4doirs/pojo/Region.java | 37 ++
.../chbenchmark4doirs/pojo/Supplier.java | 43 +++
.../queries/GenericQuery.java | 39 +++
.../chbenchmark4doirs/queries/Q1.java | 45 +++
.../chbenchmark4doirs/queries/Q10.java | 59 ++++
.../chbenchmark4doirs/queries/Q11.java | 52 +++
.../chbenchmark4doirs/queries/Q12.java | 48 +++
.../chbenchmark4doirs/queries/Q13.java | 43 +++
.../chbenchmark4doirs/queries/Q14.java | 36 ++
.../chbenchmark4doirs/queries/Q15.java | 80 +++++
.../chbenchmark4doirs/queries/Q16.java | 46 +++
.../chbenchmark4doirs/queries/Q17.java | 40 +++
.../chbenchmark4doirs/queries/Q18.java | 53 +++
.../chbenchmark4doirs/queries/Q19.java | 57 +++
.../chbenchmark4doirs/queries/Q2.java | 65 ++++
.../chbenchmark4doirs/queries/Q20.java | 47 +++
.../chbenchmark4doirs/queries/Q21.java | 59 ++++
.../chbenchmark4doirs/queries/Q22.java | 60 ++++
.../chbenchmark4doirs/queries/Q3.java | 55 +++
.../chbenchmark4doirs/queries/Q4.java | 42 +++
.../chbenchmark4doirs/queries/Q5.java | 60 ++++
.../chbenchmark4doirs/queries/Q6.java | 35 ++
.../chbenchmark4doirs/queries/Q7.java | 68 ++++
.../chbenchmark4doirs/queries/Q8.java | 65 ++++
.../chbenchmark4doirs/queries/Q9.java | 59 ++++
31 files changed, 1909 insertions(+)
create mode 100644 config/doris/sample_chbenchmark_config.xml
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmark.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkLoader.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkWorker.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Nation.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Region.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Supplier.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/GenericQuery.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q1.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q10.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q11.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q12.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q13.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q14.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q15.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q16.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q17.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q18.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q19.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q2.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q20.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q21.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q22.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q3.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q4.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q5.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q6.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q7.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q8.java
create mode 100644 src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q9.java
diff --git a/config/doris/sample_chbenchmark_config.xml b/config/doris/sample_chbenchmark_config.xml
new file mode 100644
index 00000000..eb8243c7
--- /dev/null
+++ b/config/doris/sample_chbenchmark_config.xml
@@ -0,0 +1,140 @@
+
+
+
+
+ MYSQL
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://doris:9033/doris_100w_0215?rewriteBatchedStatements=true
+
+ root
+
+ TRANSACTION_READ_UNCOMMITTED
+ 128
+
+
+ 100
+
+
+
+ 10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 200
+ disabled
+
+ unlimited
+
+
+
+
+
+
+ 45,43,4,4,4
+ 3, 2, 3, 2, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
+
+
+
+
+
+
+
+
+ Q1
+
+
+ Q2
+
+
+ Q3
+
+
+ Q4
+
+
+ Q5
+
+
+ Q6
+
+
+ Q7
+
+
+ Q8
+
+
+ Q9
+
+
+ Q10
+
+
+ Q11
+
+
+ Q12
+
+
+ Q13
+
+
+ Q14
+
+
+ Q15
+
+
+ Q16
+
+
+ Q17
+
+
+ Q18
+
+
+ Q19
+
+
+ Q20
+
+
+ Q21
+
+
+ Q22
+
+
+
+
+
+
+ NewOrder
+
+
+ Payment
+
+
+ OrderStatus
+
+
+ Delivery
+
+
+ StockLevel
+
+
+
\ No newline at end of file
diff --git a/config/plugin.xml b/config/plugin.xml
index 4edd0d2a..c44d4c65 100644
--- a/config/plugin.xml
+++ b/config/plugin.xml
@@ -19,4 +19,5 @@
com.oltpbenchmark.benchmarks.chbenchmarkForTrino.chbenchmark.CHBenCHmark
com.oltpbenchmark.benchmarks.chbenchmarkForSpark.chbenchmark.CHBenCHmark
com.oltpbenchmark.benchmarks.chbenchmark4impala.CHBenCHmark
+ com.oltpbenchmark.benchmarks.chbenchmark4doirs.CHBenCHmark
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmark.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmark.java
new file mode 100644
index 00000000..f8f05c3a
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmark.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs;
+
+
+import com.oltpbenchmark.WorkloadConfiguration;
+import com.oltpbenchmark.api.BenchmarkModule;
+import com.oltpbenchmark.api.Loader;
+import com.oltpbenchmark.api.Worker;
+import com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries.Q1;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class CHBenCHmark extends BenchmarkModule {
+ private static final Logger LOG = LoggerFactory.getLogger(CHBenCHmark.class);
+
+ public CHBenCHmark(WorkloadConfiguration workConf) {
+ super(workConf);
+ }
+
+ protected Package getProcedurePackageImpl() {
+ return (Q1.class.getPackage());
+ }
+
+ @Override
+ protected List> makeWorkersImpl() {
+ // HACK: Turn off terminal messages
+ List> workers = new ArrayList<>();
+
+ int numTerminals = workConf.getTerminals();
+ LOG.info(String.format("Creating %d workers for CHBenCHMark", numTerminals));
+ for (int i = 0; i < numTerminals; i++) {
+ workers.add(new CHBenCHmarkWorker(this, i));
+ }
+
+ return workers;
+ }
+
+ protected Loader makeLoaderImpl() {
+ return new CHBenCHmarkLoader(this);
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkLoader.java
new file mode 100644
index 00000000..aa651a1b
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkLoader.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs;
+
+
+import com.oltpbenchmark.api.Loader;
+import com.oltpbenchmark.api.LoaderThread;
+import com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo.Nation;
+import com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo.Region;
+import com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo.Supplier;
+import com.oltpbenchmark.util.RandomGenerator;
+import org.apache.commons.io.IOUtils;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStream;
+import java.nio.charset.Charset;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+import java.util.concurrent.CountDownLatch;
+
+public class CHBenCHmarkLoader extends Loader {
+ private static final RandomGenerator ran = new RandomGenerator(0);
+
+
+ //create possible keys for n_nationkey ([a-zA-Z0-9])
+ private static final int[] nationkeys = new int[62];
+
+ static {
+ for (char i = 0; i < 10; i++) {
+ nationkeys[i] = '0' + i;
+ }
+ for (char i = 0; i < 26; i++) {
+ nationkeys[i + 10] = 'A' + i;
+ }
+ for (char i = 0; i < 26; i++) {
+ nationkeys[i + 36] = 'a' + i;
+ }
+ }
+
+ public CHBenCHmarkLoader(CHBenCHmark benchmark) {
+ super(benchmark);
+ }
+
+ @Override
+ public List createLoaderThreads() {
+ List threads = new ArrayList<>();
+
+ final CountDownLatch regionLatch = new CountDownLatch(1);
+
+ threads.add(new LoaderThread(this.benchmark) {
+ @Override
+ public void load(Connection conn) throws SQLException {
+ try (PreparedStatement statement = conn.prepareStatement("INSERT INTO region " + " (r_regionkey, r_name, r_comment) " + "VALUES (?, ?, ?)")) {
+
+ loadRegions(conn, statement);
+ }
+ }
+
+ @Override
+ public void afterLoad() {
+ regionLatch.countDown();
+ }
+ });
+
+ final CountDownLatch nationLatch = new CountDownLatch(1);
+
+ threads.add(new LoaderThread(this.benchmark) {
+ @Override
+ public void load(Connection conn) throws SQLException {
+
+ try (PreparedStatement statement = conn.prepareStatement("INSERT INTO nation " + " (n_nationkey, n_name, n_regionkey, n_comment) " + "VALUES (?, ?, ?, ?)")) {
+
+ loadNations(conn, statement);
+ }
+ }
+
+ @Override
+ public void beforeLoad() {
+ try {
+ regionLatch.await();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ @Override
+ public void afterLoad() {
+ nationLatch.countDown();
+ }
+ });
+
+ threads.add(new LoaderThread(this.benchmark) {
+ @Override
+ public void load(Connection conn) throws SQLException {
+ try (PreparedStatement statement = conn.prepareStatement("INSERT INTO supplier " + " (su_suppkey, su_name, su_address, su_nationkey, su_phone, su_acctbal, su_comment) " + "VALUES (?, ?, ?, ?, ?, ?, ?)")) {
+
+ loadSuppliers(conn, statement);
+ }
+ }
+
+ @Override
+ public void beforeLoad() {
+ try {
+ nationLatch.await();
+ } catch (InterruptedException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ return threads;
+ }
+
+ private void truncateTable(Connection conn, String strTable) {
+
+ LOG.debug("Truncating '{}' ...", strTable);
+ try (Statement statement = conn.createStatement()) {
+ statement.execute("DELETE FROM " + strTable);
+ } catch (SQLException se) {
+ LOG.debug(se.getMessage());
+ }
+ }
+
+ private int loadRegions(Connection conn, PreparedStatement statement) throws SQLException {
+
+ int k = 0;
+ int t = 0;
+ BufferedReader br = null;
+
+
+ truncateTable(conn, "region");
+ truncateTable(conn, "nation");
+ truncateTable(conn, "supplier");
+
+ Region region = new Region();
+
+ final String path = "benchmarks" + File.separator + this.benchmark.getBenchmarkName() + File.separator + "region_gen.tbl";
+
+ try (InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(path)) {
+
+ List lines = IOUtils.readLines(resourceAsStream, Charset.defaultCharset());
+
+ for (String line : lines) {
+ StringTokenizer st = new StringTokenizer(line, "|");
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ region.r_regionkey = Integer.parseInt(st.nextToken());
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ region.r_name = st.nextToken();
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ region.r_comment = st.nextToken();
+ if (st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+
+ k++;
+
+ statement.setLong(1, region.r_regionkey);
+ statement.setString(2, region.r_name);
+ statement.setString(3, region.r_comment);
+ statement.addBatch();
+
+ if ((k % workConf.getBatchSize()) == 0) {
+
+ statement.executeBatch();
+ statement.clearBatch();
+ }
+
+ }
+
+ statement.executeBatch();
+ statement.clearBatch();
+
+ } catch (SQLException se) {
+ LOG.debug(se.getMessage());
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ return (k);
+
+ }
+
+ private int loadNations(Connection conn, PreparedStatement statement) {
+
+ int k = 0;
+ int t = 0;
+
+ Nation nation = new Nation();
+
+ final String path = "benchmarks" + File.separator + this.benchmark.getBenchmarkName() + File.separator + "nation_gen.tbl";
+
+ try (final InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream(path)) {
+
+ List lines = IOUtils.readLines(resourceAsStream, Charset.defaultCharset());
+
+ for (String line : lines) {
+ StringTokenizer st = new StringTokenizer(line, "|");
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ nation.n_nationkey = Integer.parseInt(st.nextToken());
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ nation.n_name = st.nextToken();
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ nation.n_regionkey = Integer.parseInt(st.nextToken());
+ if (!st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+ nation.n_comment = st.nextToken();
+ if (st.hasMoreTokens()) {
+ LOG.error("invalid input file: {}", path);
+ }
+
+ k++;
+
+ statement.setLong(1, nation.n_nationkey);
+ statement.setString(2, nation.n_name);
+ statement.setLong(3, nation.n_regionkey);
+ statement.setString(4, nation.n_comment);
+ statement.addBatch();
+
+ if ((k % workConf.getBatchSize()) == 0) {
+
+ statement.executeBatch();
+ statement.clearBatch();
+ }
+
+ }
+
+
+ statement.executeBatch();
+ statement.clearBatch();
+
+
+ } catch (SQLException se) {
+ LOG.debug(se.getMessage());
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ return (k);
+
+ }
+
+ private int loadSuppliers(Connection conn, PreparedStatement statement) {
+
+ int k = 0;
+ int t = 0;
+
+ try {
+
+ Supplier supplier = new Supplier();
+
+ for (int index = 1; index <= 10000; index++) {
+ supplier.su_suppkey = index;
+ supplier.su_name = ran.astring(25, 25);
+ supplier.su_address = ran.astring(20, 40);
+ supplier.su_nationkey = nationkeys[ran.number(0, 61)];
+ supplier.su_phone = ran.nstring(15, 15);
+ supplier.su_acctbal = (float) ran.fixedPoint(2, 10000., 1000000000.);
+ supplier.su_comment = ran.astring(51, 101);
+
+ k++;
+
+ statement.setLong(1, supplier.su_suppkey);
+ statement.setString(2, supplier.su_name);
+ statement.setString(3, supplier.su_address);
+ statement.setLong(4, supplier.su_nationkey);
+ statement.setString(5, supplier.su_phone);
+ statement.setDouble(6, supplier.su_acctbal);
+ statement.setString(7, supplier.su_comment);
+ statement.addBatch();
+
+ if ((k % workConf.getBatchSize()) == 0) {
+
+ statement.executeBatch();
+ statement.clearBatch();
+ }
+ }
+
+
+ statement.executeBatch();
+ statement.clearBatch();
+
+
+ } catch (SQLException se) {
+ LOG.debug(se.getMessage());
+ } catch (Exception e) {
+ LOG.error(e.getMessage(), e);
+ }
+
+ return (k);
+
+ }
+
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkWorker.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkWorker.java
new file mode 100644
index 00000000..bee3809f
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/CHBenCHmarkWorker.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs;
+
+import com.oltpbenchmark.api.Procedure.UserAbortException;
+import com.oltpbenchmark.api.TransactionType;
+import com.oltpbenchmark.api.Worker;
+import com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries.GenericQuery;
+import com.oltpbenchmark.types.TransactionStatus;
+import com.oltpbenchmark.types.TransactionStatusAndIsCommit;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+
+public class CHBenCHmarkWorker extends Worker {
+ public CHBenCHmarkWorker(CHBenCHmark benchmarkModule, int id) {
+ super(benchmarkModule, id);
+ }
+
+ @Override
+ protected TransactionStatusAndIsCommit executeWork(Connection conn, TransactionType nextTransaction) throws UserAbortException, SQLException {
+ try {
+ GenericQuery proc = (GenericQuery) this.getProcedure(nextTransaction.getProcedureClass());
+ proc.run(conn);
+ } catch (ClassCastException e) {
+ throw new RuntimeException(e);
+ }
+
+ return new TransactionStatusAndIsCommit(TransactionStatus.SUCCESS);
+
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Nation.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Nation.java
new file mode 100644
index 00000000..ed1b9550
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Nation.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo;
+
+//>>> CH-benCHmark
+public class Nation {
+
+ public int n_nationkey; // PRIMARY KEY
+ public String n_name;
+ public int n_regionkey;
+ public String n_comment;
+
+ @Override
+ public String toString() {
+ return ("\n***************** Nation ********************"
+ + "\n* n_nationkey = " + n_nationkey + "\n* n_name = " + n_name
+ + "\n* n_regionkey = " + n_regionkey + "\n* n_comment = " + n_comment
+ + "\n**********************************************");
+ }
+
+}
+
+//<<< CH-benCHmark
\ No newline at end of file
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Region.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Region.java
new file mode 100644
index 00000000..d4b8c088
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Region.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo;
+
+//>>> CH-benCHmark
+public class Region {
+
+ public int r_regionkey; // PRIMARY KEY
+ public String r_name;
+ public String r_comment;
+
+ @Override
+ public String toString() {
+ return ("\n***************** Region ********************"
+ + "\n* r_regionkey = " + r_regionkey + "\n* r_name = " + r_name
+ + "\n* r_comment = " + r_comment + "\n**********************************************");
+ }
+
+}
+
+//<<< CH-benCHmark
\ No newline at end of file
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Supplier.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Supplier.java
new file mode 100644
index 00000000..e7ef92d8
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/pojo/Supplier.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.pojo;
+
+//>>> CH-benCHmark
+public class Supplier {
+
+ public int su_suppkey; // PRIMARY KEY
+ public String su_name;
+ public String su_address;
+ public int su_nationkey;
+ public String su_phone;
+ public float su_acctbal;
+ public String su_comment;
+
+ @Override
+ public String toString() {
+ return ("\n***************** Supplier ********************"
+ + "\n* su_suppkey = " + su_suppkey + "\n* su_name = " + su_name
+ + "\n* su_address = " + su_address + "\n* su_nationkey = " + su_nationkey
+ + "\n* su_phone = " + su_phone + "\n* su_acctbal = " + su_acctbal
+ + "\n* su_comment = " + su_comment + "\n**********************************************");
+ }
+
+}
+
+//<<< CH-benCHmark
\ No newline at end of file
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/GenericQuery.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/GenericQuery.java
new file mode 100644
index 00000000..4f8bf47b
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/GenericQuery.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.Procedure;
+import com.oltpbenchmark.api.SQLStmt;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+public abstract class GenericQuery extends Procedure {
+
+ protected abstract SQLStmt get_query();
+
+ public void run(Connection conn) throws SQLException {
+ try (PreparedStatement stmt = this.getPreparedStatement(conn, get_query()); ResultSet rs = stmt.executeQuery()) {
+ while (rs.next()) {
+ //do nothing
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q1.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q1.java
new file mode 100644
index 00000000..307ee214
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q1.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q1 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT ol_number, "
+ + "sum(ol_quantity) AS sum_qty, "
+ + "sum(ol_amount) AS sum_amount, "
+ + "avg(ol_quantity) AS avg_qty, "
+ + "avg(ol_amount) AS avg_amount, "
+ + "count(*) AS count_order "
+ + "FROM order_line "
+ + "WHERE ol_delivery_d > '2007-01-02 00:00:00.000000' "
+ + "GROUP BY ol_number "
+ + "ORDER BY ol_number"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q1().query_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q10.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q10.java
new file mode 100644
index 00000000..cef993bf
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q10.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q10 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT c_id, "
+ + "c_last, "
+ + "sum(ol_amount) AS revenue, "
+ + "c_city, "
+ + "c_phone, "
+ + "n_name "
+ + "FROM customer, "
+ + "oorder, "
+ + "order_line, "
+ + "nation "
+ + "WHERE c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND o_entry_d >= '2007-01-02 00:00:00.000000' "
+ + "AND o_entry_d <= ol_delivery_d "
+ + "AND n_nationkey = ascii(substring(c_state,1,1)) "
+ + "GROUP BY c_id, "
+ + "c_last, "
+ + "c_city, "
+ + "c_phone, "
+ + "n_name "
+ + "ORDER BY revenue DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q10().query_stmt.getSQL());
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q11.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q11.java
new file mode 100644
index 00000000..e26fd559
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q11.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q11 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT s_i_id, "
+ + "sum(s_order_cnt) AS ordercount "
+ + "FROM stock, "
+ + "supplier, "
+ + "nation "
+ + "WHERE mod((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_name = 'Germany' "
+ + "GROUP BY s_i_id HAVING sum(s_order_cnt) > "
+ + "(SELECT sum(s_order_cnt) * .005 "
+ + "FROM stock, "
+ + "supplier, "
+ + "nation "
+ + "WHERE mod((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_name = 'Germany') "
+ + "ORDER BY ordercount DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q11().query_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q12.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q12.java
new file mode 100644
index 00000000..5da6afbb
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q12.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q12 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT o_ol_cnt, "
+ + "sum(CASE WHEN o_carrier_id = 1 "
+ + "OR o_carrier_id = 2 THEN 1 ELSE 0 END) AS high_line_count, "
+ + "sum(CASE WHEN o_carrier_id <> 1 "
+ + "AND o_carrier_id <> 2 THEN 1 ELSE 0 END) AS low_line_count "
+ + "FROM oorder, "
+ + "order_line "
+ + "WHERE ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND o_entry_d <= ol_delivery_d "
+ + "AND ol_delivery_d < '2020-01-01 00:00:00.000000' "
+ + "GROUP BY o_ol_cnt "
+ + "ORDER BY o_ol_cnt"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q12().query_stmt.getSQL());
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q13.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q13.java
new file mode 100644
index 00000000..bd597c8e
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q13.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q13 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT c_count, "
+ + "count(*) AS custdist "
+ + "FROM "
+ + "(SELECT c_id, "
+ + "count(o_id) AS c_count "
+ + "FROM customer "
+ + "LEFT OUTER JOIN oorder ON (c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND c_id = o_c_id "
+ + "AND o_carrier_id > 8) "
+ + "GROUP BY c_id) AS c_orders "
+ + "GROUP BY c_count "
+ + "ORDER BY custdist DESC, c_count DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q14.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q14.java
new file mode 100644
index 00000000..fc4d2c01
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q14.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q14 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT (100.00 * sum(CASE WHEN i_data LIKE 'PR%' THEN ol_amount ELSE 0 END) / (1 + sum(ol_amount))) AS promo_revenue "
+ + "FROM order_line, "
+ + "item "
+ + "WHERE ol_i_id = i_id "
+ + "AND ol_delivery_d >= '2007-01-02 00:00:00.000000' "
+ + "AND ol_delivery_d < '2020-01-02 00:00:00.000000'"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q15.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q15.java
new file mode 100644
index 00000000..b329c06d
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q15.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+public class Q15 extends GenericQuery {
+
+ public final SQLStmt createview_stmt = new SQLStmt(
+ "CREATE view revenue0 (supplier_no, total_revenue) AS "
+ + "SELECT "
+ + "mod((s_w_id * s_i_id),10000) as supplier_no, "
+ + "sum(ol_amount) as total_revenue "
+ + "FROM "
+ + "order_line, stock "
+ + "WHERE "
+ + "ol_i_id = s_i_id "
+ + "AND ol_supply_w_id = s_w_id "
+ + "AND ol_delivery_d >= '2007-01-02 00:00:00.000000' "
+ + "GROUP BY "
+ + "supplier_no"
+ );
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT su_suppkey, "
+ + "su_name, "
+ + "su_address, "
+ + "su_phone, "
+ + "total_revenue "
+ + "FROM supplier, revenue0 "
+ + "WHERE su_suppkey = supplier_no "
+ + "AND total_revenue = (select max(total_revenue) from revenue0) "
+ + "ORDER BY su_suppkey"
+ );
+
+ public final SQLStmt dropview_stmt = new SQLStmt(
+ "DROP VIEW revenue0"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public void run(Connection conn) throws SQLException {
+ // With this query, we have to set up a view before we execute the
+ // query, then drop it once we're done.
+ try (Statement stmt = conn.createStatement()) {
+ try {
+ stmt.executeUpdate(createview_stmt.getSQL());
+ super.run(conn);
+ } finally {
+ stmt.executeUpdate(dropview_stmt.getSQL());
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q15().createview_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q16.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q16.java
new file mode 100644
index 00000000..d1918efb
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q16.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q16 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT i_name, "
+ + "substring(i_data,1,3) AS brand, "
+ + "i_price, "
+ + "count(DISTINCT (mod((s_w_id * s_i_id),10000))) AS supplier_cnt "
+ + "FROM stock, "
+ + "item "
+ + "WHERE i_id = s_i_id "
+ + "AND i_data NOT LIKE 'zz%' "
+ + "AND (mod((s_w_id * s_i_id),10000) NOT IN "
+ + "(SELECT su_suppkey "
+ + "FROM supplier "
+ + "WHERE su_comment LIKE '%bad%')) "
+ + "GROUP BY i_name, "
+ + "brand, "
+ + "i_price "
+ + "ORDER BY supplier_cnt DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q17.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q17.java
new file mode 100644
index 00000000..31f6104c
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q17.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q17 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT SUM(ol_amount) / 2.0 AS avg_yearly "
+ + "FROM order_line, "
+ + "(SELECT i_id, AVG (ol_quantity) AS a "
+ + "FROM item, "
+ + "order_line "
+ + "WHERE i_data LIKE '%b' "
+ + "AND ol_i_id = i_id "
+ + "GROUP BY i_id) t "
+ + "WHERE ol_i_id = t.i_id "
+ + "AND ol_quantity < t.a"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q18.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q18.java
new file mode 100644
index 00000000..c1b2fc1c
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q18.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q18 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT c_last, "
+ + "c_id, "
+ + "o_id, "
+ + "o_entry_d, "
+ + "o_ol_cnt, "
+ + "sum(ol_amount) AS amount_sum "
+ + "FROM customer, "
+ + "oorder, "
+ + "order_line "
+ + "WHERE c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "GROUP BY o_id, "
+ + "o_w_id, "
+ + "o_d_id, "
+ + "c_id, "
+ + "c_last, "
+ + "o_entry_d, "
+ + "o_ol_cnt HAVING sum(ol_amount) > 200 "
+ + "ORDER BY amount_sum DESC, o_entry_d"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q19.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q19.java
new file mode 100644
index 00000000..202af6b4
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q19.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q19 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT sum(ol_amount) AS revenue "
+ + "FROM order_line, "
+ + "item "
+ + "WHERE (ol_i_id = i_id "
+ + "AND i_data LIKE '%a' "
+ + "AND ol_quantity >= 1 "
+ + "AND ol_quantity <= 10 "
+ + "AND i_price BETWEEN 1 AND 400000 "
+ + "AND ol_w_id IN (1, "
+ + "2, "
+ + "3)) "
+ + "OR (ol_i_id = i_id "
+ + "AND i_data LIKE '%b' "
+ + "AND ol_quantity >= 1 "
+ + "AND ol_quantity <= 10 "
+ + "AND i_price BETWEEN 1 AND 400000 "
+ + "AND ol_w_id IN (1, "
+ + "2, "
+ + "4)) "
+ + "OR (ol_i_id = i_id "
+ + "AND i_data LIKE '%c' "
+ + "AND ol_quantity >= 1 "
+ + "AND ol_quantity <= 10 "
+ + "AND i_price BETWEEN 1 AND 400000 "
+ + "AND ol_w_id IN (1, "
+ + "5, "
+ + "3))"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q2.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q2.java
new file mode 100644
index 00000000..fb95496a
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q2.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q2 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT su_suppkey, "
+ + "su_name, "
+ + "n_name, "
+ + "i_id, "
+ + "i_name, "
+ + "su_address, "
+ + "su_phone, "
+ + "su_comment "
+ + "FROM item, supplier, stock, nation, region, "
+ + "(SELECT s_i_id AS m_i_id, MIN(s_quantity) AS m_s_quantity "
+ + "FROM stock, "
+ + "supplier, "
+ + "nation, "
+ + "region "
+ + "WHERE MOD((s_w_id*s_i_id), 10000)=su_suppkey "
+ + "AND su_nationkey=n_nationkey "
+ + "AND n_regionkey=r_regionkey "
+ + "AND r_name LIKE 'Europ%' "
+ + "GROUP BY s_i_id) m "
+ + "WHERE i_id = s_i_id "
+ + "AND MOD((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_regionkey = r_regionkey "
+ + "AND i_data LIKE '%b' "
+ + "AND r_name LIKE 'Europ%' "
+ + "AND i_id=m_i_id "
+ + "AND s_quantity = m_s_quantity "
+ + "ORDER BY n_name, "
+ + "su_name, "
+ + "i_id"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q2().query_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q20.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q20.java
new file mode 100644
index 00000000..dc74405a
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q20.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q20 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT su_name, "
+ + "su_address "
+ + "FROM supplier, "
+ + "nation "
+ + "WHERE su_suppkey IN "
+ + "(SELECT mod(s_i_id * s_w_id, 10000) "
+ + "FROM stock "
+ + "INNER JOIN item ON i_id = s_i_id "
+ + "INNER JOIN order_line ON ol_i_id = s_i_id "
+ + "WHERE ol_delivery_d > '2010-05-23 12:00:00' "
+ + "AND i_data LIKE 'co%' "
+ + "GROUP BY s_i_id, "
+ + "s_w_id, "
+ + "s_quantity HAVING 2*s_quantity > sum(ol_quantity)) "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_name = 'Germany' "
+ + "ORDER BY su_name"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q21.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q21.java
new file mode 100644
index 00000000..2ece6bb1
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q21.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q21 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT /*+SET_VAR(enable_cost_based_join_reorder=true) */ su_name, "
+ + "count(*) AS numwait "
+ + "FROM supplier, "
+ + "order_line l1, "
+ + "oorder, "
+ + "stock, "
+ + "nation "
+ + "WHERE ol_o_id = o_id "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_w_id = s_w_id "
+ + "AND ol_i_id = s_i_id "
+ + "AND mod((s_w_id * s_i_id),10000) = su_suppkey "
+ + "AND l1.ol_delivery_d > o_entry_d "
+ + "AND NOT EXISTS "
+ + "(SELECT * "
+ + "FROM order_line l2 "
+ + "WHERE l2.ol_o_id = l1.ol_o_id "
+ + "AND l2.ol_w_id = l1.ol_w_id "
+ + "AND l2.ol_d_id = l1.ol_d_id "
+ + "AND l2.ol_delivery_d > l1.ol_delivery_d) "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_name = 'Germany' "
+ + "GROUP BY su_name "
+ + "ORDER BY numwait DESC, su_name"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q21().query_stmt.getSQL());
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q22.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q22.java
new file mode 100644
index 00000000..bc0d5139
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q22.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q22 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT substring(c_state,1,1) AS country, "
+ + "count(*) AS numcust, "
+ + "sum(c_balance) AS totacctbal "
+ + "FROM customer "
+ + "WHERE substring(c_phone,1,1) IN ('1', "
+ + "'2', "
+ + "'3', "
+ + "'4', "
+ + "'5', "
+ + "'6', "
+ + "'7') "
+ + "AND c_balance > "
+ + "(SELECT avg(c_balance) "
+ + "FROM customer "
+ + "WHERE c_balance > 0.00 "
+ + "AND substring(c_phone,1,1) IN ('1', "
+ + "'2', "
+ + "'3', "
+ + "'4', "
+ + "'5', "
+ + "'6', "
+ + "'7')) "
+ + "AND NOT EXISTS "
+ + "(SELECT * "
+ + "FROM oorder "
+ + "WHERE o_c_id = c_id "
+ + "AND o_w_id = c_w_id "
+ + "AND o_d_id = c_d_id) "
+ + "GROUP BY substring(c_state,1,1) "
+ + "ORDER BY substring(c_state,1,1)"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q3.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q3.java
new file mode 100644
index 00000000..a6182ad6
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q3.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q3 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT ol_o_id, "
+ + "ol_w_id, "
+ + "ol_d_id, "
+ + "sum(ol_amount) AS revenue, "
+ + "o_entry_d "
+ + "FROM customer, "
+ + "new_order, "
+ + "oorder, "
+ + "order_line "
+ + "WHERE c_state LIKE 'A%' "
+ + "AND c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND no_w_id = o_w_id "
+ + "AND no_d_id = o_d_id "
+ + "AND no_o_id = o_id "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND o_entry_d > '2007-01-02 00:00:00.000000' "
+ + "GROUP BY ol_o_id, "
+ + "ol_w_id, "
+ + "ol_d_id, "
+ + "o_entry_d "
+ + "ORDER BY revenue DESC , o_entry_d"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q4.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q4.java
new file mode 100644
index 00000000..be1794a0
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q4.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q4 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT o_ol_cnt, "
+ + "count(*) AS order_count "
+ + "FROM oorder "
+ + "WHERE exists "
+ + "(SELECT * "
+ + "FROM order_line "
+ + "WHERE o_id = ol_o_id "
+ + "AND o_w_id = ol_w_id "
+ + "AND o_d_id = ol_d_id "
+ + "AND ol_delivery_d >= o_entry_d) "
+ + "GROUP BY o_ol_cnt "
+ + "ORDER BY o_ol_cnt"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q5.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q5.java
new file mode 100644
index 00000000..c67f5138
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q5.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q5 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT n_name, "
+ + "sum(ol_amount) AS revenue "
+ + "FROM customer, "
+ + "oorder, "
+ + "order_line, "
+ + "stock, "
+ + "supplier, "
+ + "nation, "
+ + "region "
+ + "WHERE c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id=o_d_id "
+ + "AND ol_w_id = s_w_id "
+ + "AND ol_i_id = s_i_id "
+ + "AND MOD((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND ascii(substring(c_state, 1, 1)) = su_nationkey "
+ + "AND su_nationkey = n_nationkey "
+ + "AND n_regionkey = r_regionkey "
+ + "AND r_name = 'Europe' "
+ + "AND o_entry_d >= '2007-01-02 00:00:00.000000' "
+ + "GROUP BY n_name "
+ + "ORDER BY revenue DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q5().query_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q6.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q6.java
new file mode 100644
index 00000000..7d9d7bf6
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q6.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q6 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT sum(ol_amount) AS revenue "
+ + "FROM order_line "
+ + "WHERE ol_delivery_d >= '1999-01-01 00:00:00.000000' "
+ + "AND ol_delivery_d < '2020-01-01 00:00:00.000000' "
+ + "AND ol_quantity BETWEEN 1 AND 100000"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q7.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q7.java
new file mode 100644
index 00000000..fa09449f
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q7.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q7 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT su_nationkey AS supp_nation, "
+ + "substring(c_state, 1, 1) AS cust_nation, "
+ + "extract(YEAR "
+ + "FROM o_entry_d) AS l_year, "
+ + "sum(ol_amount) AS revenue "
+ + "FROM supplier, "
+ + "stock, "
+ + "order_line, "
+ + "oorder, "
+ + "customer, "
+ + "nation n1, "
+ + "nation n2 "
+ + "WHERE ol_supply_w_id = s_w_id "
+ + "AND ol_i_id = s_i_id "
+ + "AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND su_nationkey = n1.n_nationkey "
+ + "AND ascii(substring(c_state, 1, 1)) = n2.n_nationkey "
+ + "AND ((n1.n_name = 'Germany' "
+ + "AND n2.n_name = 'Cambodia') "
+ + "OR (n1.n_name = 'Cambodia' "
+ + "AND n2.n_name = 'Germany')) "
+ + "GROUP BY su_nationkey, "
+ + "cust_nation, "
+ + "l_year "
+ + "ORDER BY su_nationkey, "
+ + "cust_nation, "
+ + "l_year"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q7().query_stmt.getSQL());
+ }
+
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q8.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q8.java
new file mode 100644
index 00000000..29f5ed53
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q8.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+
+public class Q8 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT extract(YEAR "
+ + "FROM o_entry_d) AS l_year, "
+ + "sum(CASE WHEN n2.n_name = 'Germany' THEN ol_amount ELSE 0 END) / sum(ol_amount) AS mkt_share "
+ + "FROM item, "
+ + "supplier, "
+ + "stock, "
+ + "order_line, "
+ + "oorder, "
+ + "customer, "
+ + "nation n1, "
+ + "nation n2, "
+ + "region "
+ + "WHERE i_id = s_i_id "
+ + "AND ol_i_id = s_i_id "
+ + "AND ol_supply_w_id = s_w_id "
+ + "AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND c_id = o_c_id "
+ + "AND c_w_id = o_w_id "
+ + "AND c_d_id = o_d_id "
+ + "AND n1.n_nationkey = ascii(substring(c_state,1,1)) "
+ + "AND n1.n_regionkey = r_regionkey "
+ + "AND ol_i_id < 1000 "
+ + "AND r_name = 'Europe' "
+ + "AND su_nationkey = n2.n_nationkey "
+ + "AND i_data LIKE '%b' "
+ + "AND i_id = ol_i_id "
+ + "GROUP BY l_year "
+ + "ORDER BY l_year"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q8().query_stmt.getSQL());
+ }
+}
diff --git a/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q9.java b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q9.java
new file mode 100644
index 00000000..a76a7c86
--- /dev/null
+++ b/src/main/java/com/oltpbenchmark/benchmarks/chbenchmark4doirs/queries/Q9.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2020 by OLTPBenchmark Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package com.oltpbenchmark.benchmarks.chbenchmark4doirs.queries;
+
+import com.oltpbenchmark.api.SQLStmt;
+import com.oltpbenchmark.benchmarks.chbenchmark.queries.Q8;
+
+public class Q9 extends GenericQuery {
+
+ public final SQLStmt query_stmt = new SQLStmt(
+ "SELECT n_name, "
+ + "extract(YEAR "
+ + "FROM o_entry_d) AS l_year, "
+ + "sum(ol_amount) AS sum_profit "
+ + "FROM item, "
+ + "stock, "
+ + "supplier, "
+ + "order_line, "
+ + "oorder, "
+ + "nation "
+ + "WHERE ol_i_id = s_i_id "
+ + "AND ol_supply_w_id = s_w_id "
+ + "AND MOD ((s_w_id * s_i_id), 10000) = su_suppkey "
+ + "AND ol_w_id = o_w_id "
+ + "AND ol_d_id = o_d_id "
+ + "AND ol_o_id = o_id "
+ + "AND ol_i_id = i_id "
+ + "AND su_nationkey = n_nationkey "
+ + "AND i_data LIKE '%bb' "
+ + "GROUP BY n_name, "
+ + "l_year "
+ + "ORDER BY n_name, "
+ + "l_year DESC"
+ );
+
+ protected SQLStmt get_query() {
+ return query_stmt;
+ }
+
+ public static void main(String[] args) {
+ System.out.println(new Q9().query_stmt.getSQL());
+ }
+
+}