You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by ko...@apache.org on 2024/12/11 14:18:33 UTC
(ignite-3) branch main updated: IGNITE-23944 Sql. Add TPC DS suite (#4873)
This is an automated email from the ASF dual-hosted git repository.
korlov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new 364fe77b96 IGNITE-23944 Sql. Add TPC DS suite (#4873)
364fe77b96 is described below
commit 364fe77b96ded83094ef10de3809cf4c6ca8ae9f
Author: korlov42 <ko...@apache.org>
AuthorDate: Wed Dec 11 16:18:28 2024 +0200
IGNITE-23944 Sql. Add TPC DS suite (#4873)
---
.../benchmark/AbstractMultiNodeBenchmark.java | 8 +-
.../internal/benchmark/AbstractTpcBenchmark.java | 133 ++++
.../ignite/internal/benchmark/TpcdsBenchmark.java | 112 +++
.../ignite/internal/benchmark/TpchBenchmark.java | 77 +-
.../ignite/internal/sql/engine/util/TpcTable.java | 62 ++
.../sql/engine/util/tpcds/TpcdsHelper.java | 45 ++
.../sql/engine/util/tpcds/TpcdsTables.java | 802 +++++++++++++++++++++
.../internal/sql/engine/util/tpch/TpchHelper.java | 8 +-
.../internal/sql/engine/util/tpch/TpchTables.java | 36 +-
.../resources/tpcds/ddl/call_center.sql | 36 +
.../resources/tpcds/ddl/catalog_page.sql | 14 +
.../resources/tpcds/ddl/catalog_returns.sql | 32 +
.../resources/tpcds/ddl/catalog_sales.sql | 39 +
.../testFixtures/resources/tpcds/ddl/customer.sql | 23 +
.../resources/tpcds/ddl/customer_address.sql | 18 +
.../resources/tpcds/ddl/customer_demographics.sql | 14 +
.../testFixtures/resources/tpcds/ddl/date_dim.sql | 33 +
.../resources/tpcds/ddl/household_demographics.sql | 10 +
.../resources/tpcds/ddl/income_band.sql | 8 +
.../testFixtures/resources/tpcds/ddl/inventory.sql | 9 +
.../src/testFixtures/resources/tpcds/ddl/item.sql | 27 +
.../testFixtures/resources/tpcds/ddl/promotion.sql | 24 +
.../testFixtures/resources/tpcds/ddl/reason.sql | 8 +
.../testFixtures/resources/tpcds/ddl/ship_mode.sql | 11 +
.../src/testFixtures/resources/tpcds/ddl/store.sql | 34 +
.../resources/tpcds/ddl/store_returns.sql | 25 +
.../resources/tpcds/ddl/store_sales.sql | 28 +
.../testFixtures/resources/tpcds/ddl/time_dim.sql | 15 +
.../testFixtures/resources/tpcds/ddl/warehouse.sql | 19 +
.../testFixtures/resources/tpcds/ddl/web_page.sql | 19 +
.../resources/tpcds/ddl/web_returns.sql | 29 +
.../testFixtures/resources/tpcds/ddl/web_sales.sql | 39 +
.../testFixtures/resources/tpcds/ddl/web_site.sql | 31 +
.../src/testFixtures/resources/tpcds/query1.sql | 24 +
.../src/testFixtures/resources/tpcds/query10.sql | 59 ++
.../src/testFixtures/resources/tpcds/query11.sql | 81 +++
.../src/testFixtures/resources/tpcds/query12.sql | 34 +
.../src/testFixtures/resources/tpcds/query13.sql | 52 ++
.../src/testFixtures/resources/tpcds/query14.sql | 210 ++++++
.../src/testFixtures/resources/tpcds/query15.sql | 20 +
.../src/testFixtures/resources/tpcds/query16.sql | 31 +
.../src/testFixtures/resources/tpcds/query17.sql | 45 ++
.../src/testFixtures/resources/tpcds/query18.sql | 34 +
.../src/testFixtures/resources/tpcds/query19.sql | 25 +
.../src/testFixtures/resources/tpcds/query2.sql | 60 ++
.../src/testFixtures/resources/tpcds/query20.sql | 30 +
.../src/testFixtures/resources/tpcds/query21.sql | 30 +
.../src/testFixtures/resources/tpcds/query22.sql | 20 +
.../src/testFixtures/resources/tpcds/query23.sql | 107 +++
.../src/testFixtures/resources/tpcds/query24.sql | 107 +++
.../src/testFixtures/resources/tpcds/query25.sql | 48 ++
.../src/testFixtures/resources/tpcds/query26.sql | 21 +
.../src/testFixtures/resources/tpcds/query27.sql | 23 +
.../src/testFixtures/resources/tpcds/query28.sql | 53 ++
.../src/testFixtures/resources/tpcds/query29.sql | 47 ++
.../src/testFixtures/resources/tpcds/query3.sql | 21 +
.../src/testFixtures/resources/tpcds/query30.sql | 31 +
.../src/testFixtures/resources/tpcds/query31.sql | 52 ++
.../src/testFixtures/resources/tpcds/query32.sql | 28 +
.../src/testFixtures/resources/tpcds/query33.sql | 75 ++
.../src/testFixtures/resources/tpcds/query34.sql | 31 +
.../src/testFixtures/resources/tpcds/query35.sql | 58 ++
.../src/testFixtures/resources/tpcds/query36.sql | 30 +
.../src/testFixtures/resources/tpcds/query37.sql | 17 +
.../src/testFixtures/resources/tpcds/query38.sql | 23 +
.../src/testFixtures/resources/tpcds/query39.sql | 54 ++
.../src/testFixtures/resources/tpcds/query4.sql | 116 +++
.../src/testFixtures/resources/tpcds/query40.sql | 28 +
.../src/testFixtures/resources/tpcds/query41.sql | 52 ++
.../src/testFixtures/resources/tpcds/query42.sql | 22 +
.../src/testFixtures/resources/tpcds/query43.sql | 19 +
.../src/testFixtures/resources/tpcds/query44.sql | 35 +
.../src/testFixtures/resources/tpcds/query45.sql | 20 +
.../src/testFixtures/resources/tpcds/query46.sql | 35 +
.../src/testFixtures/resources/tpcds/query47.sql | 51 ++
.../src/testFixtures/resources/tpcds/query48.sql | 67 ++
.../src/testFixtures/resources/tpcds/query49.sql | 129 ++++
.../src/testFixtures/resources/tpcds/query5.sql | 128 ++++
.../src/testFixtures/resources/tpcds/query50.sql | 59 ++
.../src/testFixtures/resources/tpcds/query51.sql | 45 ++
.../src/testFixtures/resources/tpcds/query52.sql | 22 +
.../src/testFixtures/resources/tpcds/query53.sql | 28 +
.../src/testFixtures/resources/tpcds/query54.sql | 56 ++
.../src/testFixtures/resources/tpcds/query55.sql | 14 +
.../src/testFixtures/resources/tpcds/query56.sql | 69 ++
.../src/testFixtures/resources/tpcds/query57.sql | 48 ++
.../src/testFixtures/resources/tpcds/query58.sql | 65 ++
.../src/testFixtures/resources/tpcds/query59.sql | 44 ++
.../src/testFixtures/resources/tpcds/query6.sql | 26 +
.../src/testFixtures/resources/tpcds/query60.sql | 78 ++
.../src/testFixtures/resources/tpcds/query61.sql | 44 ++
.../src/testFixtures/resources/tpcds/query62.sql | 35 +
.../src/testFixtures/resources/tpcds/query63.sql | 29 +
.../src/testFixtures/resources/tpcds/query64.sql | 121 ++++
.../src/testFixtures/resources/tpcds/query65.sql | 29 +
.../src/testFixtures/resources/tpcds/query66.sql | 220 ++++++
.../src/testFixtures/resources/tpcds/query67.sql | 44 ++
.../src/testFixtures/resources/tpcds/query68.sql | 42 ++
.../src/testFixtures/resources/tpcds/query69.sql | 47 ++
.../src/testFixtures/resources/tpcds/query7.sql | 21 +
.../src/testFixtures/resources/tpcds/query70.sql | 38 +
.../src/testFixtures/resources/tpcds/query71.sql | 40 +
.../src/testFixtures/resources/tpcds/query72.sql | 29 +
.../src/testFixtures/resources/tpcds/query73.sql | 28 +
.../src/testFixtures/resources/tpcds/query74.sql | 61 ++
.../src/testFixtures/resources/tpcds/query75.sql | 70 ++
.../src/testFixtures/resources/tpcds/query76.sql | 24 +
.../src/testFixtures/resources/tpcds/query77.sql | 108 +++
.../src/testFixtures/resources/tpcds/query78.sql | 58 ++
.../src/testFixtures/resources/tpcds/query79.sql | 23 +
.../src/testFixtures/resources/tpcds/query8.sql | 108 +++
.../src/testFixtures/resources/tpcds/query80.sql | 96 +++
.../src/testFixtures/resources/tpcds/query81.sql | 31 +
.../src/testFixtures/resources/tpcds/query82.sql | 17 +
.../src/testFixtures/resources/tpcds/query83.sql | 67 ++
.../src/testFixtures/resources/tpcds/query84.sql | 21 +
.../src/testFixtures/resources/tpcds/query85.sql | 84 +++
.../src/testFixtures/resources/tpcds/query86.sql | 26 +
.../src/testFixtures/resources/tpcds/query87.sql | 23 +
.../src/testFixtures/resources/tpcds/query88.sql | 94 +++
.../src/testFixtures/resources/tpcds/query89.sql | 28 +
.../src/testFixtures/resources/tpcds/query9.sql | 51 ++
.../src/testFixtures/resources/tpcds/query90.sql | 22 +
.../src/testFixtures/resources/tpcds/query91.sql | 31 +
.../src/testFixtures/resources/tpcds/query92.sql | 30 +
.../src/testFixtures/resources/tpcds/query93.sql | 18 +
.../src/testFixtures/resources/tpcds/query94.sql | 29 +
.../src/testFixtures/resources/tpcds/query95.sql | 32 +
.../src/testFixtures/resources/tpcds/query96.sql | 16 +
.../src/testFixtures/resources/tpcds/query97.sql | 25 +
.../src/testFixtures/resources/tpcds/query98.sql | 33 +
.../src/testFixtures/resources/tpcds/query99.sql | 35 +
132 files changed, 6601 insertions(+), 92 deletions(-)
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java
index cb85f9d8af..706ba63982 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractMultiNodeBenchmark.java
@@ -33,6 +33,7 @@ import org.apache.ignite.IgniteServer;
import org.apache.ignite.InitParameters;
import org.apache.ignite.internal.app.IgniteImpl;
import org.apache.ignite.internal.catalog.commands.CatalogUtils;
+import org.apache.ignite.internal.failure.handlers.configuration.StopNodeOrHaltFailureHandlerConfigurationSchema;
import org.apache.ignite.internal.lang.IgniteStringFormatter;
import org.apache.ignite.internal.sql.engine.property.SqlPropertiesHelper;
import org.apache.ignite.internal.testframework.TestIgnitionManager;
@@ -72,7 +73,7 @@ public class AbstractMultiNodeBenchmark {
protected static Ignite publicIgnite;
protected static IgniteImpl igniteImpl;
- @Param({"false", "true"})
+ @Param({"false"})
private boolean fsync;
@Nullable
@@ -205,6 +206,11 @@ public class AbstractMultiNodeBenchmark {
+ " rest.port: {},\n"
+ " raft.fsync = " + fsync() + ",\n"
+ " system.partitionsLogPath = \"" + logPath() + "\",\n"
+ + " failureHandler.handler: {\n"
+ + " type: \"" + StopNodeOrHaltFailureHandlerConfigurationSchema.TYPE + "\",\n"
+ + " tryStop: true,\n"
+ + " timeoutMillis: 60000,\n" // 1 minute for graceful shutdown
+ + " },\n"
+ "}";
for (int i = 0; i < nodes(); i++) {
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractTpcBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractTpcBenchmark.java
new file mode 100644
index 0000000000..8ec3b5ab51
--- /dev/null
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/AbstractTpcBenchmark.java
@@ -0,0 +1,133 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.benchmark;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.time.Duration;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import org.apache.ignite.internal.sql.engine.util.TpcTable;
+import org.apache.ignite.sql.IgniteSql;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+
+/**
+ * Abstract benchmark class that initializes schema and fills up tables for TPC suite.
+ */
+@State(Scope.Benchmark)
+@SuppressWarnings({"WeakerAccess", "unused"})
+public abstract class AbstractTpcBenchmark extends AbstractMultiNodeBenchmark {
+ private static final String DATASET_READY_MARK_FILE_NAME = "ready.txt";
+
+ protected IgniteSql sql;
+
+ abstract TpcTable[] tablesToInit();
+
+ abstract Path pathToDataset();
+
+ /** Initializes a schema and fills tables with data. */
+ @Setup
+ public void initSchema() throws Throwable {
+ try {
+ sql = publicIgnite.sql();
+
+ if (!Files.exists(workDir().resolve(DATASET_READY_MARK_FILE_NAME))) {
+ Path pathToDataset = pathToDataset();
+
+ if (pathToDataset == null) {
+ throw new IllegalStateException("Path do dataset is not provided. Please read the comment"
+ + " in the beginning of " + this.getClass().getSimpleName() + ".class");
+ }
+
+ System.out.println("Going to create schema...");
+
+ for (TpcTable table : tablesToInit()) {
+ System.out.println("Going to create table \"" + table.tableName() + "\"...");
+ sql.executeScript(table.ddlScript());
+ System.out.println("Done");
+
+ fillTable(table, pathToDataset);
+ }
+
+ Files.createFile(workDir().resolve(DATASET_READY_MARK_FILE_NAME));
+ }
+ } catch (Throwable e) {
+ nodeTearDown();
+
+ throw e;
+ }
+ }
+
+ private void fillTable(TpcTable table, Path pathToDataset) throws Throwable {
+ System.out.println("Going to fill table \"" + table.tableName() + "\"...");
+ long start = System.nanoTime();
+ Iterable<Object[]> dataProvider = () -> {
+ try {
+ return table.dataProvider(pathToDataset);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ };
+
+ Semaphore semaphore = new Semaphore(1024); // 1024 was chosen empirically
+ AtomicReference<Throwable> exceptionHolder = new AtomicReference<>(null);
+ AtomicInteger inserted = new AtomicInteger();
+ int expectedCount = 0;
+ for (Object[] params : dataProvider) {
+ semaphore.acquire();
+ sql.executeAsync(null, table.insertPrepareStatement(), params)
+ .whenComplete((ignored, ex) -> {
+ semaphore.release();
+
+ int val = inserted.incrementAndGet();
+ if (val % 10_000 == 0) {
+ System.out.println(val + " rows uploaded to \"" + table.tableName() + "\"");
+ }
+
+ if (ex != null) {
+ exceptionHolder.compareAndSet(null, ex);
+ }
+ });
+
+ if (exceptionHolder.get() != null) {
+ throw exceptionHolder.get();
+ }
+
+ expectedCount++;
+ }
+
+ while (expectedCount != inserted.intValue()) {
+ if (exceptionHolder.get() != null) {
+ throw exceptionHolder.get();
+ }
+
+ Thread.sleep(100);
+ }
+
+ System.out.println("Table \"" + table.tableName() + "\" filled in " + Duration.ofNanos(System.nanoTime() - start));
+ }
+
+ @Override
+ protected void createTable(String tableName) {
+ // NO-OP
+ }
+}
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpcdsBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpcdsBenchmark.java
new file mode 100644
index 0000000000..5a0562a52f
--- /dev/null
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpcdsBenchmark.java
@@ -0,0 +1,112 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.benchmark;
+
+import java.nio.file.Path;
+import java.util.concurrent.TimeUnit;
+import org.apache.ignite.internal.sql.engine.util.TpcTable;
+import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsHelper;
+import org.apache.ignite.internal.sql.engine.util.tpcds.TpcdsTables;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.BenchmarkMode;
+import org.openjdk.jmh.annotations.Fork;
+import org.openjdk.jmh.annotations.Measurement;
+import org.openjdk.jmh.annotations.Mode;
+import org.openjdk.jmh.annotations.OutputTimeUnit;
+import org.openjdk.jmh.annotations.Param;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.Threads;
+import org.openjdk.jmh.annotations.Warmup;
+import org.openjdk.jmh.infra.Blackhole;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.Options;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+/**
+ * Benchmark that runs sql queries from TPC-DS suite via embedded client.
+ */
+@State(Scope.Benchmark)
+@Fork(1)
+@Threads(1)
+@Warmup(iterations = 10, time = 2)
+@Measurement(iterations = 20, time = 2)
+@BenchmarkMode(Mode.AverageTime)
+@OutputTimeUnit(TimeUnit.MILLISECONDS)
+@SuppressWarnings({"WeakerAccess", "unused"})
+public class TpcdsBenchmark extends AbstractTpcBenchmark {
+ /*
+ Minimal configuration of this benchmark requires specifying pathToDataset. Dataset is set of CSV
+ files with name `{$tableName}.dat` per each table and character `|` as separator.
+
+ By default, cluster's work directory will be created as a temporary folder. This implies,
+ that all data generated by benchmark will be cleared automatically. However, this also implies
+ that cluster will be recreated on EVERY RUN. To initialize cluster once and then reuse it state
+ override `AbstractMultiNodeBenchmark.workDir()` method. Don't forget to clear that directory afterwards.
+ */
+
+ @Override
+ TpcTable[] tablesToInit() {
+ return TpcdsTables.values();
+ }
+
+ @Override
+ Path pathToDataset() {
+ throw new RuntimeException("Provide path to directory containing <table_name>.dat files");
+ }
+
+ @Param("1")
+ private String queryId;
+
+ private String queryString;
+
+ /** Initializes a query string. */
+ @Setup
+ public void setUp() throws Throwable {
+ try {
+ queryString = TpcdsHelper.getQuery(queryId);
+ } catch (Throwable e) {
+ nodeTearDown();
+
+ throw e;
+ }
+ }
+
+ /** Benchmark that measures performance of queries from TPC-DS suite. */
+ @Benchmark
+ public void run(Blackhole bh) {
+ try (var rs = sql.execute(null, queryString)) {
+ while (rs.hasNext()) {
+ bh.consume(rs.next());
+ }
+ }
+ }
+
+ /**
+ * Benchmark's entry point.
+ */
+ public static void main(String[] args) throws RunnerException {
+ Options opt = new OptionsBuilder()
+ .include(".*" + TpcdsBenchmark.class.getSimpleName() + ".*")
+ .build();
+
+ new Runner(opt).run();
+ }
+}
diff --git a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpchBenchmark.java b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpchBenchmark.java
index 4d26e2449c..81706f940f 100644
--- a/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpchBenchmark.java
+++ b/modules/runner/src/integrationTest/java/org/apache/ignite/internal/benchmark/TpchBenchmark.java
@@ -17,14 +17,11 @@
package org.apache.ignite.internal.benchmark;
-import java.io.IOException;
-import java.nio.file.Files;
import java.nio.file.Path;
-import java.time.Duration;
import java.util.concurrent.TimeUnit;
+import org.apache.ignite.internal.sql.engine.util.TpcTable;
import org.apache.ignite.internal.sql.engine.util.tpch.TpchHelper;
import org.apache.ignite.internal.sql.engine.util.tpch.TpchTables;
-import org.apache.ignite.sql.IgniteSql;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
@@ -54,7 +51,7 @@ import org.openjdk.jmh.runner.options.OptionsBuilder;
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.MILLISECONDS)
@SuppressWarnings({"WeakerAccess", "unused"})
-public class TpchBenchmark extends AbstractMultiNodeBenchmark {
+public class TpchBenchmark extends AbstractTpcBenchmark {
/*
Minimal configuration of this benchmark requires specifying pathToDataset. Latest known location
of dataset is https://github.com/cmu-db/benchbase/tree/main/data/tpch-sf0.01 for scale factor 0.01
@@ -63,18 +60,20 @@ public class TpchBenchmark extends AbstractMultiNodeBenchmark {
By default, cluster's work directory will be created as a temporary folder. This implies,
that all data generated by benchmark will be cleared automatically. However, this also implies
- that cluster will be recreated on EVERY RUN. Given there are 25 queries and 2 different modes
- (fsync on/off), it results in 50 schema initialization and data upload cycles. To initialize
- cluster once and then reuse it state override `AbstractMultiNodeBenchmark.workDir()` method.
- Don't forget to clear that directory afterwards.
+ that cluster will be recreated on EVERY RUN. Given there are 25 queries, it results in 25 schema
+ initialization and data upload cycles. To initialize cluster once and then reuse it state override
+ `AbstractMultiNodeBenchmark.workDir()` method. Don't forget to clear that directory afterwards.
*/
- private static final String DATASET_READY_MARK_FILE_NAME = "ready.txt";
-
- private final Path pathToDataset = null;
+ @Override
+ TpcTable[] tablesToInit() {
+ return TpchTables.values();
+ }
- /** Useful when you need to initialize only subset of tables. */
- private final TpchTables[] tablesToInit = TpchTables.values();
+ @Override
+ Path pathToDataset() {
+ throw new RuntimeException("Provide path to directory containing <table_name>.tbl files");
+ }
@Param({
"1", "2", "3", "4", "5", "6", "7", "8", "8v", "9", "10", "11", "12", "12v",
@@ -82,34 +81,12 @@ public class TpchBenchmark extends AbstractMultiNodeBenchmark {
})
private String queryId;
- private IgniteSql sql;
private String queryString;
- /** Initializes a schema and fills tables with data. */
+ /** Initializes a query string. */
@Setup
public void setUp() throws Exception {
try {
- sql = publicIgnite.sql();
-
- if (!Files.exists(workDir().resolve(DATASET_READY_MARK_FILE_NAME))) {
- if (pathToDataset == null) {
- throw new IllegalStateException("Path do dataset is not provided. Please read the comment"
- + " in the beginning of TpchBenchmark.class");
- }
-
- System.out.println("Going to create schema...");
-
- for (TpchTables table : tablesToInit) {
- System.out.println("Going to create table \"" + table.tableName() + "\"...");
- sql.executeScript(table.ddlScript());
- System.out.println("Done");
-
- fillTable(table);
- }
-
- Files.createFile(workDir().resolve(DATASET_READY_MARK_FILE_NAME));
- }
-
queryString = TpchHelper.getQuery(queryId);
} catch (Exception e) {
nodeTearDown();
@@ -138,30 +115,4 @@ public class TpchBenchmark extends AbstractMultiNodeBenchmark {
new Runner(opt).run();
}
-
- private void fillTable(TpchTables table) {
- System.out.println("Going to fill table \"" + table.tableName() + "\"...");
- long start = System.nanoTime();
- int count = 0;
- Iterable<Object[]> dataProvider = () -> {
- try {
- return table.dataProvider(pathToDataset);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- };
- for (Object[] params : dataProvider) {
- sql.execute(null, table.insertPrepareStatement(), params);
-
- if (++count % 10_000 == 0) {
- System.out.println("Uploaded " + count + " rows");
- }
- }
- System.out.println("Done in " + Duration.ofNanos(System.nanoTime() - start));
- }
-
- @Override
- protected void createTable(String tableName) {
- // NO-OP
- }
}
diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/TpcTable.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/TpcTable.java
new file mode 100644
index 0000000000..c3b43336e5
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/TpcTable.java
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.sql.engine.util;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Iterator;
+import org.apache.ignite.sql.IgniteSql;
+import org.apache.ignite.table.KeyValueView;
+
+/** A table from TPC suite. */
+public interface TpcTable {
+ /** Returns name of the table. */
+ String tableName();
+
+ /** Returns number of column in the table. */
+ int columnsCount();
+
+ /** Returns name of the column with given 0-based index. */
+ String columnName(int idx);
+
+ /** Returns definition of a table including necessary indexes. */
+ String ddlScript();
+
+ /**
+ * Returns DML string representing single-row INSERT statement with dynamic parameters placeholders.
+ *
+ * <p>The order of columns matches the order provided in table declaration, i.e. it's the same
+ * order like in output of {@code SELECT * FROM table_name} statement, as well as the same order
+ * in which column names are returned from {@link #columnName(int)} method.
+ *
+ * <p>The statement returned is tolerant to columns' type mismatch, implying you
+ * can use any value while there is cast from provided value to required type.
+ */
+ String insertPrepareStatement();
+
+ /**
+ * Returns iterator returning rows of the corresponding table.
+ *
+ * <p>May be used to fill the table via {@link KeyValueView KV API} or {@link IgniteSql SQL API}.
+ *
+ * @param pathToDataset A path to a directory with CSV file containing data for the table.
+ * @return Iterator over data of the table.
+ * @throws IOException In case of error.
+ */
+ Iterator<Object[]> dataProvider(Path pathToDataset) throws IOException;
+}
diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsHelper.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsHelper.java
new file mode 100644
index 0000000000..128b8d866d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsHelper.java
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.sql.engine.util.tpcds;
+
+import static org.apache.ignite.internal.sql.engine.util.tpch.TpchHelper.loadFromResource;
+
+/**
+ * Provides utility methods to work with queries defined by the TPC-DS benchmark.
+ */
+public final class TpcdsHelper {
+
+ private TpcdsHelper() {
+
+ }
+
+ /**
+ * Loads a TPC-DS query given a query identifier. Query identifier can be in the following forms:
+ * <ul>
+ * <li>query id - a number, e.g. {@code 14}. Queries are stored in files named {@code query{id}.sql}.</li>
+ * </ul>
+ *
+ * @param queryId The identifier of a query.
+ * @return An SQL query.
+ */
+ public static String getQuery(String queryId) {
+ int numericId = Integer.parseInt(queryId);
+ var queryFile = String.format("tpcds/query%s.sql", numericId);
+ return loadFromResource(queryFile);
+ }
+}
diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsTables.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsTables.java
new file mode 100644
index 0000000000..872ffd079a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpcds/TpcdsTables.java
@@ -0,0 +1,802 @@
+/*
+ * 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.
+ */
+
+package org.apache.ignite.internal.sql.engine.util.tpcds;
+
+import static org.apache.ignite.sql.ColumnType.DATE;
+import static org.apache.ignite.sql.ColumnType.DECIMAL;
+import static org.apache.ignite.sql.ColumnType.INT32;
+import static org.apache.ignite.sql.ColumnType.STRING;
+
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.time.LocalDate;
+import java.util.Iterator;
+import org.apache.ignite.internal.sql.engine.util.TpcTable;
+import org.apache.ignite.internal.sql.engine.util.tpch.TpchHelper;
+import org.apache.ignite.sql.ColumnType;
+
+/**
+ * Enumeration of tables from TPC-DS specification.
+ */
+@SuppressWarnings("NonSerializableFieldInSerializableClass")
+public enum TpcdsTables implements TpcTable {
+ CUSTOMER(
+ new Column("C_CUSTOMER_SK", INT32),
+ new Column("C_CUSTOMER_ID", STRING),
+ new Column("C_CURRENT_CDEMO_SK", INT32),
+ new Column("C_CURRENT_HDEMO_SK", INT32),
+ new Column("C_CURRENT_ADDR_SK", INT32),
+ new Column("C_FIRST_SHIPTO_DATE_SK", INT32),
+ new Column("C_FIRST_SALES_DATE_SK", INT32),
+ new Column("C_SALUTATION", STRING),
+ new Column("C_FIRST_NAME", STRING),
+ new Column("C_LAST_NAME", STRING),
+ new Column("C_PREFERRED_CUST_FLAG", STRING),
+ new Column("C_BIRTH_DAY", INT32),
+ new Column("C_BIRTH_MONTH", INT32),
+ new Column("C_BIRTH_YEAR", INT32),
+ new Column("C_BIRTH_COUNTRY", STRING),
+ new Column("C_LOGIN", STRING),
+ new Column("C_EMAIL_ADDRESS", STRING),
+ new Column("C_LAST_REVIEW_DATE_SK", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::varchar(10), ?::varchar(20), ?::varchar(30), ?::varchar,"
+ + " ?::integer, ?::integer, ?::integer, ?::varchar(20), ?::varchar(13), ?::varchar(50), ?::integer);";
+ }
+ },
+
+ WEB_PAGE(
+ new Column("WP_WEB_PAGE_SK", INT32),
+ new Column("WP_WEB_PAGE_ID", STRING),
+ new Column("WP_REC_START_DATE", DATE),
+ new Column("WP_REC_END_DATE", DATE),
+ new Column("WP_CREATION_DATE_SK", INT32),
+ new Column("WP_ACCESS_DATE_SK", INT32),
+ new Column("WP_AUTOGEN_FLAG", STRING),
+ new Column("WP_CUSTOMER_SK", INT32),
+ new Column("WP_URL", STRING),
+ new Column("WP_TYPE", STRING),
+ new Column("WP_CHAR_COUNT", INT32),
+ new Column("WP_LINK_COUNT", INT32),
+ new Column("WP_IMAGE_COUNT", INT32),
+ new Column("WP_MAX_AD_COUNT", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::date, ?::integer,"
+ + " ?::integer, ?::varchar, ?::integer, ?::varchar(100), ?::varchar(50), ?::integer,"
+ + " ?::integer, ?::integer, ?::integer);";
+ }
+ },
+
+ STORE_SALES(
+ new Column("SS_SOLD_DATE_SK", INT32),
+ new Column("SS_SOLD_TIME_SK", INT32),
+ new Column("SS_ITEM_SK", INT32),
+ new Column("SS_CUSTOMER_SK", INT32),
+ new Column("SS_CDEMO_SK", INT32),
+ new Column("SS_HDEMO_SK", INT32),
+ new Column("SS_ADDR_SK", INT32),
+ new Column("SS_STORE_SK", INT32),
+ new Column("SS_PROMO_SK", INT32),
+ new Column("SS_TICKET_NUMBER", INT32),
+ new Column("SS_QUANTITY", INT32),
+ new Column("SS_WHOLESALE_COST", DECIMAL),
+ new Column("SS_LIST_PRICE", DECIMAL),
+ new Column("SS_SALES_PRICE", DECIMAL),
+ new Column("SS_EXT_DISCOUNT_AMT", DECIMAL),
+ new Column("SS_EXT_SALES_PRICE", DECIMAL),
+ new Column("SS_EXT_WHOLESALE_COST", DECIMAL),
+ new Column("SS_EXT_LIST_PRICE", DECIMAL),
+ new Column("SS_EXT_TAX", DECIMAL),
+ new Column("SS_COUPON_AMT", DECIMAL),
+ new Column("SS_NET_PAID", DECIMAL),
+ new Column("SS_NET_PAID_INC_TAX", DECIMAL),
+ new Column("SS_NET_PROFIT", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2));";
+ }
+ },
+
+ HOUSEHOLD_DEMOGRAPHICS(
+ new Column("HD_DEMO_SK", INT32),
+ new Column("HD_INCOME_BAND_SK", INT32),
+ new Column("HD_BUY_POTENTIAL", STRING),
+ new Column("HD_DEP_COUNT", INT32),
+ new Column("HD_VEHICLE_COUNT", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::varchar(15),"
+ + " ?::integer, ?::integer);";
+ }
+ },
+
+ CATALOG_PAGE(
+ new Column("CP_CATALOG_PAGE_SK", INT32),
+ new Column("CP_CATALOG_PAGE_ID", STRING),
+ new Column("CP_START_DATE_SK", INT32),
+ new Column("CP_END_DATE_SK", INT32),
+ new Column("CP_DEPARTMENT", STRING),
+ new Column("CP_CATALOG_NUMBER", INT32),
+ new Column("CP_CATALOG_PAGE_NUMBER", INT32),
+ new Column("CP_DESCRIPTION", STRING),
+ new Column("CP_TYPE", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::integer, ?::integer,"
+ + " ?::varchar(50), ?::integer, ?::integer, ?::varchar(100), ?::varchar(100));";
+ }
+ },
+
+ WEB_SITE(
+ new Column("WEB_SITE_SK", INT32),
+ new Column("WEB_SITE_ID", STRING),
+ new Column("WEB_REC_START_DATE", DATE),
+ new Column("WEB_REC_END_DATE", DATE),
+ new Column("WEB_NAME", STRING),
+ new Column("WEB_OPEN_DATE_SK", INT32),
+ new Column("WEB_CLOSE_DATE_SK", INT32),
+ new Column("WEB_CLASS", STRING),
+ new Column("WEB_MANAGER", STRING),
+ new Column("WEB_MKT_ID", INT32),
+ new Column("WEB_MKT_CLASS", STRING),
+ new Column("WEB_MKT_DESC", STRING),
+ new Column("WEB_MARKET_MANAGER", STRING),
+ new Column("WEB_COMPANY_ID", INT32),
+ new Column("WEB_COMPANY_NAME", STRING),
+ new Column("WEB_STREET_NUMBER", STRING),
+ new Column("WEB_STREET_NAME", STRING),
+ new Column("WEB_STREET_TYPE", STRING),
+ new Column("WEB_SUITE_NUMBER", STRING),
+ new Column("WEB_CITY", STRING),
+ new Column("WEB_COUNTY", STRING),
+ new Column("WEB_STATE", STRING),
+ new Column("WEB_ZIP", STRING),
+ new Column("WEB_COUNTRY", STRING),
+ new Column("WEB_GMT_OFFSET", DECIMAL),
+ new Column("WEB_TAX_PERCENTAGE", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::date, ?::varchar(50),"
+ + " ?::integer, ?::integer, ?::varchar(50), ?::varchar(40), ?::integer, ?::varchar(50),"
+ + " ?::varchar(100), ?::varchar(40), ?::integer, ?::varchar(50), ?::varchar(10), ?::varchar(60),"
+ + " ?::varchar(15), ?::varchar(10), ?::varchar(60), ?::varchar(30), ?::varchar(2),"
+ + " ?::varchar(10), ?::varchar(20), ?::numeric(5, 2), ?::numeric(5, 2));";
+ }
+ },
+
+ CUSTOMER_DEMOGRAPHICS(
+ new Column("CD_DEMO_SK", INT32),
+ new Column("CD_GENDER", STRING),
+ new Column("CD_MARITAL_STATUS", STRING),
+ new Column("CD_EDUCATION_STATUS", STRING),
+ new Column("CD_PURCHASE_ESTIMATE", INT32),
+ new Column("CD_CREDIT_RATING", STRING),
+ new Column("CD_DEP_COUNT", INT32),
+ new Column("CD_DEP_EMPLOYED_COUNT", INT32),
+ new Column("CD_DEP_COLLEGE_COUNT", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar, ?::varchar, ?::varchar(20),"
+ + " ?::integer, ?::varchar(10), ?::integer, ?::integer, ?::integer);";
+ }
+ },
+
+ ITEM(
+ new Column("I_ITEM_SK", INT32),
+ new Column("I_ITEM_ID", STRING),
+ new Column("I_REC_START_DATE", DATE),
+ new Column("I_REC_END_DATE", DATE),
+ new Column("I_ITEM_DESC", STRING),
+ new Column("I_CURRENT_PRICE", DECIMAL),
+ new Column("I_WHOLESALE_COST", DECIMAL),
+ new Column("I_BRAND_ID", INT32),
+ new Column("I_BRAND", STRING),
+ new Column("I_CLASS_ID", INT32),
+ new Column("I_CLASS", STRING),
+ new Column("I_CATEGORY_ID", INT32),
+ new Column("I_CATEGORY", STRING),
+ new Column("I_MANUFACT_ID", INT32),
+ new Column("I_MANUFACT", STRING),
+ new Column("I_SIZE", STRING),
+ new Column("I_FORMULATION", STRING),
+ new Column("I_COLOR", STRING),
+ new Column("I_UNITS", STRING),
+ new Column("I_CONTAINER", STRING),
+ new Column("I_MANAGER_ID", INT32),
+ new Column("I_PRODUCT_NAME", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::date, ?::varchar(200),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::integer, ?::varchar(50), ?::integer,"
+ + " ?::varchar(50), ?::integer, ?::varchar(50), ?::integer, ?::varchar(50), ?::varchar(20),"
+ + " ?::varchar(20), ?::varchar(20), ?::varchar(10), ?::varchar(10), ?::integer, ?::varchar(50));";
+ }
+ },
+
+ WAREHOUSE(
+ new Column("W_WAREHOUSE_SK", INT32),
+ new Column("W_WAREHOUSE_ID", STRING),
+ new Column("W_WAREHOUSE_NAME", STRING),
+ new Column("W_WAREHOUSE_SQ_FT", INT32),
+ new Column("W_STREET_NUMBER", STRING),
+ new Column("W_STREET_NAME", STRING),
+ new Column("W_STREET_TYPE", STRING),
+ new Column("W_SUITE_NUMBER", STRING),
+ new Column("W_CITY", STRING),
+ new Column("W_COUNTY", STRING),
+ new Column("W_STATE", STRING),
+ new Column("W_ZIP", STRING),
+ new Column("W_COUNTRY", STRING),
+ new Column("W_GMT_OFFSET", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::varchar(20), ?::integer,"
+ + " ?::varchar(10), ?::varchar(60), ?::varchar(15), ?::varchar(10), ?::varchar(60),"
+ + " ?::varchar(30), ?::varchar(2), ?::varchar(10), ?::varchar(20), ?::numeric(5, 2));";
+ }
+ },
+
+ STORE_RETURNS(
+ new Column("SR_RETURNED_DATE_SK", INT32),
+ new Column("SR_RETURN_TIME_SK", INT32),
+ new Column("SR_ITEM_SK", INT32),
+ new Column("SR_CUSTOMER_SK", INT32),
+ new Column("SR_CDEMO_SK", INT32),
+ new Column("SR_HDEMO_SK", INT32),
+ new Column("SR_ADDR_SK", INT32),
+ new Column("SR_STORE_SK", INT32),
+ new Column("SR_REASON_SK", INT32),
+ new Column("SR_TICKET_NUMBER", INT32),
+ new Column("SR_RETURN_QUANTITY", INT32),
+ new Column("SR_RETURN_AMT", DECIMAL),
+ new Column("SR_RETURN_TAX", DECIMAL),
+ new Column("SR_RETURN_AMT_INC_TAX", DECIMAL),
+ new Column("SR_FEE", DECIMAL),
+ new Column("SR_RETURN_SHIP_COST", DECIMAL),
+ new Column("SR_REFUNDED_CASH", DECIMAL),
+ new Column("SR_REVERSED_CHARGE", DECIMAL),
+ new Column("SR_STORE_CREDIT", DECIMAL),
+ new Column("SR_NET_LOSS", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2));";
+ }
+ },
+
+ SHIP_MODE(
+ new Column("SM_SHIP_MODE_SK", INT32),
+ new Column("SM_SHIP_MODE_ID", STRING),
+ new Column("SM_TYPE", STRING),
+ new Column("SM_CODE", STRING),
+ new Column("SM_CARRIER", STRING),
+ new Column("SM_CONTRACT", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::varchar(30),"
+ + " ?::varchar(10), ?::varchar(20), ?::varchar(20));";
+ }
+ },
+
+ INCOME_BAND(
+ new Column("IB_INCOME_BAND_SK", INT32),
+ new Column("IB_LOWER_BOUND", INT32),
+ new Column("IB_UPPER_BOUND", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer);";
+ }
+ },
+
+ TIME_DIM(
+ new Column("T_TIME_SK", INT32),
+ new Column("T_TIME_ID", STRING),
+ new Column("T_TIME", INT32),
+ new Column("T_HOUR", INT32),
+ new Column("T_MINUTE", INT32),
+ new Column("T_SECOND", INT32),
+ new Column("T_AM_PM", STRING),
+ new Column("T_SHIFT", STRING),
+ new Column("T_SUB_SHIFT", STRING),
+ new Column("T_MEAL_TIME", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::varchar(2), ?::varchar(20), ?::varchar(20), ?::varchar(20));";
+ }
+ },
+
+ CATALOG_RETURNS(
+ new Column("CR_RETURNED_DATE_SK", INT32),
+ new Column("CR_RETURNED_TIME_SK", INT32),
+ new Column("CR_ITEM_SK", INT32),
+ new Column("CR_REFUNDED_CUSTOMER_SK", INT32),
+ new Column("CR_REFUNDED_CDEMO_SK", INT32),
+ new Column("CR_REFUNDED_HDEMO_SK", INT32),
+ new Column("CR_REFUNDED_ADDR_SK", INT32),
+ new Column("CR_RETURNING_CUSTOMER_SK", INT32),
+ new Column("CR_RETURNING_CDEMO_SK", INT32),
+ new Column("CR_RETURNING_HDEMO_SK", INT32),
+ new Column("CR_RETURNING_ADDR_SK", INT32),
+ new Column("CR_CALL_CENTER_SK", INT32),
+ new Column("CR_CATALOG_PAGE_SK", INT32),
+ new Column("CR_SHIP_MODE_SK", INT32),
+ new Column("CR_WAREHOUSE_SK", INT32),
+ new Column("CR_REASON_SK", INT32),
+ new Column("CR_ORDER_NUMBER", INT32),
+ new Column("CR_RETURN_QUANTITY", INT32),
+ new Column("CR_RETURN_AMOUNT", DECIMAL),
+ new Column("CR_RETURN_TAX", DECIMAL),
+ new Column("CR_RETURN_AMT_INC_TAX", DECIMAL),
+ new Column("CR_FEE", DECIMAL),
+ new Column("CR_RETURN_SHIP_COST", DECIMAL),
+ new Column("CR_REFUNDED_CASH", DECIMAL),
+ new Column("CR_REVERSED_CHARGE", DECIMAL),
+ new Column("CR_STORE_CREDIT", DECIMAL),
+ new Column("CR_NET_LOSS", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2));";
+ }
+ },
+
+ REASON(
+ new Column("R_REASON_SK", INT32),
+ new Column("R_REASON_ID", STRING),
+ new Column("R_REASON_DESC", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::varchar(100));";
+ }
+ },
+
+ STORE(
+ new Column("S_STORE_SK", INT32),
+ new Column("S_STORE_ID", STRING),
+ new Column("S_REC_START_DATE", DATE),
+ new Column("S_REC_END_DATE", DATE),
+ new Column("S_CLOSED_DATE_SK", INT32),
+ new Column("S_STORE_NAME", STRING),
+ new Column("S_NUMBER_EMPLOYEES", INT32),
+ new Column("S_FLOOR_SPACE", INT32),
+ new Column("S_HOURS", STRING),
+ new Column("S_MANAGER", STRING),
+ new Column("S_MARKET_ID", INT32),
+ new Column("S_GEOGRAPHY_CLASS", STRING),
+ new Column("S_MARKET_DESC", STRING),
+ new Column("S_MARKET_MANAGER", STRING),
+ new Column("S_DIVISION_ID", INT32),
+ new Column("S_DIVISION_NAME", STRING),
+ new Column("S_COMPANY_ID", INT32),
+ new Column("S_COMPANY_NAME", STRING),
+ new Column("S_STREET_NUMBER", STRING),
+ new Column("S_STREET_NAME", STRING),
+ new Column("S_STREET_TYPE", STRING),
+ new Column("S_SUITE_NUMBER", STRING),
+ new Column("S_CITY", STRING),
+ new Column("S_COUNTY", STRING),
+ new Column("S_STATE", STRING),
+ new Column("S_ZIP", STRING),
+ new Column("S_COUNTRY", STRING),
+ new Column("S_GMT_OFFSET", DECIMAL),
+ new Column("S_TAX_PERCENTAGE", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::date, ?::integer,"
+ + " ?::varchar(50), ?::integer, ?::integer, ?::varchar(20), ?::varchar(40), ?::integer,"
+ + " ?::varchar(100), ?::varchar(100), ?::varchar(40), ?::integer, ?::varchar(50),"
+ + " ?::integer, ?::varchar(50), ?::varchar(10), ?::varchar(60), ?::varchar(15),"
+ + " ?::varchar(10), ?::varchar(60), ?::varchar(30), ?::varchar(2), ?::varchar(10),"
+ + " ?::varchar(20), ?::numeric(5, 2), ?::numeric(5, 2));";
+ }
+ },
+
+ INVENTORY(
+ new Column("INV_DATE_SK", INT32),
+ new Column("INV_ITEM_SK", INT32),
+ new Column("INV_WAREHOUSE_SK", INT32),
+ new Column("INV_QUANTITY_ON_HAND", INT32)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer);";
+ }
+ },
+
+ WEB_SALES(
+ new Column("WS_SOLD_DATE_SK", INT32),
+ new Column("WS_SOLD_TIME_SK", INT32),
+ new Column("WS_SHIP_DATE_SK", INT32),
+ new Column("WS_ITEM_SK", INT32),
+ new Column("WS_BILL_CUSTOMER_SK", INT32),
+ new Column("WS_BILL_CDEMO_SK", INT32),
+ new Column("WS_BILL_HDEMO_SK", INT32),
+ new Column("WS_BILL_ADDR_SK", INT32),
+ new Column("WS_SHIP_CUSTOMER_SK", INT32),
+ new Column("WS_SHIP_CDEMO_SK", INT32),
+ new Column("WS_SHIP_HDEMO_SK", INT32),
+ new Column("WS_SHIP_ADDR_SK", INT32),
+ new Column("WS_WEB_PAGE_SK", INT32),
+ new Column("WS_WEB_SITE_SK", INT32),
+ new Column("WS_SHIP_MODE_SK", INT32),
+ new Column("WS_WAREHOUSE_SK", INT32),
+ new Column("WS_PROMO_SK", INT32),
+ new Column("WS_ORDER_NUMBER", INT32),
+ new Column("WS_QUANTITY", INT32),
+ new Column("WS_WHOLESALE_COST", DECIMAL),
+ new Column("WS_LIST_PRICE", DECIMAL),
+ new Column("WS_SALES_PRICE", DECIMAL),
+ new Column("WS_EXT_DISCOUNT_AMT", DECIMAL),
+ new Column("WS_EXT_SALES_PRICE", DECIMAL),
+ new Column("WS_EXT_WHOLESALE_COST", DECIMAL),
+ new Column("WS_EXT_LIST_PRICE", DECIMAL),
+ new Column("WS_EXT_TAX", DECIMAL),
+ new Column("WS_COUPON_AMT", DECIMAL),
+ new Column("WS_EXT_SHIP_COST", DECIMAL),
+ new Column("WS_NET_PAID", DECIMAL),
+ new Column("WS_NET_PAID_INC_TAX", DECIMAL),
+ new Column("WS_NET_PAID_INC_SHIP", DECIMAL),
+ new Column("WS_NET_PAID_INC_SHIP_TAX", DECIMAL),
+ new Column("WS_NET_PROFIT", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2));";
+ }
+ },
+
+ DATE_DIM(
+ new Column("d_date_sk", INT32),
+ new Column("d_date_id", STRING),
+ new Column("d_date", DATE),
+ new Column("d_month_seq", INT32),
+ new Column("d_week_seq", INT32),
+ new Column("d_quarter_seq", INT32),
+ new Column("d_year", INT32),
+ new Column("d_dow", INT32),
+ new Column("d_moy", INT32),
+ new Column("d_dom", INT32),
+ new Column("d_qoy", INT32),
+ new Column("d_fy_year", INT32),
+ new Column("d_fy_quarter_seq", INT32),
+ new Column("d_fy_week_seq", INT32),
+ new Column("d_day_name", STRING),
+ new Column("d_quarter_name", STRING),
+ new Column("d_holiday", STRING),
+ new Column("d_weekend", STRING),
+ new Column("d_following_holiday", STRING),
+ new Column("d_first_dom", INT32),
+ new Column("d_last_dom", INT32),
+ new Column("d_same_day_ly", INT32),
+ new Column("d_same_day_lq", INT32),
+ new Column("d_current_day", STRING),
+ new Column("d_current_week", STRING),
+ new Column("d_current_month", STRING),
+ new Column("d_current_quarter", STRING),
+ new Column("d_current_year", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::varchar(9), ?::varchar(6), ?::varchar(1), ?::varchar(1),"
+ + " ?::varchar(1), ?::integer, ?::integer, ?::integer, ?::integer, ?::varchar(1),"
+ + " ?::varchar(1), ?::varchar(1), ?::varchar(1), ?::varchar(1));";
+ }
+ },
+
+ CALL_CENTER(
+ new Column("CC_CALL_CENTER_SK", INT32),
+ new Column("CC_CALL_CENTER_ID", STRING),
+ new Column("CC_REC_START_DATE", DATE),
+ new Column("CC_REC_END_DATE", DATE),
+ new Column("CC_CLOSED_DATE_SK", INT32),
+ new Column("CC_OPEN_DATE_SK", INT32),
+ new Column("CC_NAME", STRING),
+ new Column("CC_CLASS", STRING),
+ new Column("CC_EMPLOYEES", INT32),
+ new Column("CC_SQ_FT", INT32),
+ new Column("CC_HOURS", STRING),
+ new Column("CC_MANAGER", STRING),
+ new Column("CC_MKT_ID", INT32),
+ new Column("CC_MKT_CLASS", STRING),
+ new Column("CC_MKT_DESC", STRING),
+ new Column("CC_MARKET_MANAGER", STRING),
+ new Column("CC_DIVISION", INT32),
+ new Column("CC_DIVISION_NAME", STRING),
+ new Column("CC_COMPANY", INT32),
+ new Column("CC_COMPANY_NAME", STRING),
+ new Column("CC_STREET_NUMBER", STRING),
+ new Column("CC_STREET_NAME", STRING),
+ new Column("CC_STREET_TYPE", STRING),
+ new Column("CC_SUITE_NUMBER", STRING),
+ new Column("CC_CITY", STRING),
+ new Column("CC_COUNTY", STRING),
+ new Column("CC_STATE", STRING),
+ new Column("CC_ZIP", STRING),
+ new Column("CC_COUNTRY", STRING),
+ new Column("CC_GMT_OFFSET", DECIMAL),
+ new Column("CC_TAX_PERCENTAGE", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::date, ?::date, ?::integer,"
+ + " ?::integer, ?::varchar(50), ?::varchar(50), ?::integer, ?::integer, ?::varchar(20),"
+ + " ?::varchar(40), ?::integer, ?::varchar(50), ?::varchar(100), ?::varchar(40),"
+ + " ?::integer, ?::varchar(50), ?::integer, ?::varchar(50), ?::varchar(10), ?::varchar(60),"
+ + " ?::varchar(15), ?::varchar(10), ?::varchar(60), ?::varchar(30), ?::varchar(2),"
+ + " ?::varchar(10), ?::varchar(20), ?::numeric(5, 2), ?::numeric(5, 2));";
+ }
+ },
+
+ WEB_RETURNS(
+ new Column("WR_RETURNED_DATE_SK", INT32),
+ new Column("WR_RETURNED_TIME_SK", INT32),
+ new Column("WR_ITEM_SK", INT32),
+ new Column("WR_REFUNDED_CUSTOMER_SK", INT32),
+ new Column("WR_REFUNDED_CDEMO_SK", INT32),
+ new Column("WR_REFUNDED_HDEMO_SK", INT32),
+ new Column("WR_REFUNDED_ADDR_SK", INT32),
+ new Column("WR_RETURNING_CUSTOMER_SK", INT32),
+ new Column("WR_RETURNING_CDEMO_SK", INT32),
+ new Column("WR_RETURNING_HDEMO_SK", INT32),
+ new Column("WR_RETURNING_ADDR_SK", INT32),
+ new Column("WR_WEB_PAGE_SK", INT32),
+ new Column("WR_REASON_SK", INT32),
+ new Column("WR_ORDER_NUMBER", INT32),
+ new Column("WR_RETURN_QUANTITY", INT32),
+ new Column("WR_RETURN_AMT", DECIMAL),
+ new Column("WR_RETURN_TAX", DECIMAL),
+ new Column("WR_RETURN_AMT_INC_TAX", DECIMAL),
+ new Column("WR_FEE", DECIMAL),
+ new Column("WR_RETURN_SHIP_COST", DECIMAL),
+ new Column("WR_REFUNDED_CASH", DECIMAL),
+ new Column("WR_REVERSED_CHARGE", DECIMAL),
+ new Column("WR_ACCOUNT_CREDIT", DECIMAL),
+ new Column("WR_NET_LOSS", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2));";
+ }
+ },
+
+ PROMOTION(
+ new Column("P_PROMO_SK", INT32),
+ new Column("P_PROMO_ID", STRING),
+ new Column("P_START_DATE_SK", INT32),
+ new Column("P_END_DATE_SK", INT32),
+ new Column("P_ITEM_SK", INT32),
+ new Column("P_COST", DECIMAL),
+ new Column("P_RESPONSE_TARGET", INT32),
+ new Column("P_PROMO_NAME", STRING),
+ new Column("P_CHANNEL_DMAIL", STRING),
+ new Column("P_CHANNEL_EMAIL", STRING),
+ new Column("P_CHANNEL_CATALOG", STRING),
+ new Column("P_CHANNEL_TV", STRING),
+ new Column("P_CHANNEL_RADIO", STRING),
+ new Column("P_CHANNEL_PRESS", STRING),
+ new Column("P_CHANNEL_EVENT", STRING),
+ new Column("P_CHANNEL_DEMO", STRING),
+ new Column("P_CHANNEL_DETAILS", STRING),
+ new Column("P_PURPOSE", STRING),
+ new Column("P_DISCOUNT_ACTIVE", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::integer, ?::integer,"
+ + " ?::integer, ?::numeric(15, 2), ?::integer, ?::varchar(50), ?::varchar, ?::varchar,"
+ + " ?::varchar, ?::varchar, ?::varchar, ?::varchar, ?::varchar, ?::varchar, ?::varchar(100),"
+ + " ?::varchar(15), ?::varchar);";
+ }
+ },
+
+ CUSTOMER_ADDRESS(
+ new Column("CA_ADDRESS_SK", INT32),
+ new Column("CA_ADDRESS_ID", STRING),
+ new Column("CA_STREET_NUMBER", STRING),
+ new Column("CA_STREET_NAME", STRING),
+ new Column("CA_STREET_TYPE", STRING),
+ new Column("CA_SUITE_NUMBER", STRING),
+ new Column("CA_CITY", STRING),
+ new Column("CA_COUNTY", STRING),
+ new Column("CA_STATE", STRING),
+ new Column("CA_ZIP", STRING),
+ new Column("CA_COUNTRY", STRING),
+ new Column("CA_GMT_OFFSET", DECIMAL),
+ new Column("CA_LOCATION_TYPE", STRING)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::varchar(16), ?::varchar(10),"
+ + " ?::varchar(60), ?::varchar(15), ?::varchar(10), ?::varchar(60), ?::varchar(30),"
+ + " ?::varchar(2), ?::varchar(10), ?::varchar(20), ?::numeric(5, 2), ?::varchar(20));";
+ }
+ },
+
+ CATALOG_SALES(
+ new Column("CS_SOLD_DATE_SK", INT32),
+ new Column("CS_SOLD_TIME_SK", INT32),
+ new Column("CS_SHIP_DATE_SK", INT32),
+ new Column("CS_BILL_CUSTOMER_SK", INT32),
+ new Column("CS_BILL_CDEMO_SK", INT32),
+ new Column("CS_BILL_HDEMO_SK", INT32),
+ new Column("CS_BILL_ADDR_SK", INT32),
+ new Column("CS_SHIP_CUSTOMER_SK", INT32),
+ new Column("CS_SHIP_CDEMO_SK", INT32),
+ new Column("CS_SHIP_HDEMO_SK", INT32),
+ new Column("CS_SHIP_ADDR_SK", INT32),
+ new Column("CS_CALL_CENTER_SK", INT32),
+ new Column("CS_CATALOG_PAGE_SK", INT32),
+ new Column("CS_SHIP_MODE_SK", INT32),
+ new Column("CS_WAREHOUSE_SK", INT32),
+ new Column("CS_ITEM_SK", INT32),
+ new Column("CS_PROMO_SK", INT32),
+ new Column("CS_ORDER_NUMBER", INT32),
+ new Column("CS_QUANTITY", INT32),
+ new Column("CS_WHOLESALE_COST", DECIMAL),
+ new Column("CS_LIST_PRICE", DECIMAL),
+ new Column("CS_SALES_PRICE", DECIMAL),
+ new Column("CS_EXT_DISCOUNT_AMT", DECIMAL),
+ new Column("CS_EXT_SALES_PRICE", DECIMAL),
+ new Column("CS_EXT_WHOLESALE_COST", DECIMAL),
+ new Column("CS_EXT_LIST_PRICE", DECIMAL),
+ new Column("CS_EXT_TAX", DECIMAL),
+ new Column("CS_COUPON_AMT", DECIMAL),
+ new Column("CS_EXT_SHIP_COST", DECIMAL),
+ new Column("CS_NET_PAID", DECIMAL),
+ new Column("CS_NET_PAID_INC_TAX", DECIMAL),
+ new Column("CS_NET_PAID_INC_SHIP", DECIMAL),
+ new Column("CS_NET_PAID_INC_SHIP_TAX", DECIMAL),
+ new Column("CS_NET_PROFIT", DECIMAL)
+ ) {
+ @Override
+ public String insertPrepareStatement() {
+ return "INSERT INTO " + tableName() + " VALUES (?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer, ?::integer,"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2),"
+ + " ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2), ?::numeric(7, 2));";
+ }
+ };
+
+ private final Column[] columns;
+
+ TpcdsTables(Column... columns) {
+ this.columns = columns;
+ }
+
+ /** Returns name of the table. */
+ @Override
+ public String tableName() {
+ return name().toLowerCase();
+ }
+
+ /** Returns number of column in the table. */
+ @Override
+ public int columnsCount() {
+ return columns.length;
+ }
+
+ @Override
+ public String columnName(int idx) {
+ return columns[idx].name;
+ }
+
+ /** Returns definition of a table including necessary indexes. */
+ @Override
+ public String ddlScript() {
+ return TpchHelper.loadFromResource("tpcds/ddl/" + tableName() + ".sql");
+ }
+
+ @SuppressWarnings("resource")
+ @Override
+ public Iterator<Object[]> dataProvider(Path pathToDataset) throws IOException {
+ return Files.lines(pathToDataset.resolve(tableName() + ".dat"))
+ .map(this::csvLineToTableValues)
+ .iterator();
+ }
+
+ private Object[] csvLineToTableValues(String line) {
+ String[] stringValues = line.split("\\|");
+ Object[] values = new Object[columns.length];
+
+ for (int i = 0; i < columns.length; i++) {
+ if (stringValues.length <= i) {
+ // all trailing columns are nulls
+ continue;
+ }
+
+ String value = stringValues[i];
+ if (value.isEmpty()) {
+ continue;
+ }
+
+ switch (columns[i].type) {
+ case INT32:
+ values[i] = Integer.valueOf(stringValues[i]);
+ break;
+ case DECIMAL:
+ values[i] = new BigDecimal(stringValues[i]);
+ break;
+ case DATE:
+ values[i] = LocalDate.parse(stringValues[i]);
+ break;
+ case STRING:
+ values[i] = stringValues[i];
+ break;
+ default:
+ throw new IllegalStateException(columns[i].type.toString());
+ }
+ }
+
+ return values;
+ }
+
+ private static class Column {
+ private final String name;
+ private final ColumnType type;
+
+ private Column(String name, ColumnType type) {
+ this.name = name;
+ this.type = type;
+ }
+ }
+}
diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchHelper.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchHelper.java
index 29308336ad..ffcdac849c 100644
--- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchHelper.java
+++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchHelper.java
@@ -65,7 +65,13 @@ public final class TpchHelper {
}
}
- static String loadFromResource(String resource) {
+ /**
+ * Loads resource with given name as string.
+ *
+ * @param resource Name of the resource to load.
+ * @return Resource as string.
+ */
+ public static String loadFromResource(String resource) {
try (InputStream is = TpchHelper.class.getClassLoader().getResourceAsStream(resource)) {
if (is == null) {
throw new IllegalArgumentException("Resource does not exist: " + resource);
diff --git a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchTables.java b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchTables.java
index 9d79229c54..bdd2b60cd6 100644
--- a/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchTables.java
+++ b/modules/sql-engine/src/testFixtures/java/org/apache/ignite/internal/sql/engine/util/tpch/TpchTables.java
@@ -28,14 +28,14 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.time.LocalDate;
import java.util.Iterator;
+import org.apache.ignite.internal.sql.engine.util.TpcTable;
import org.apache.ignite.sql.ColumnType;
-import org.apache.ignite.sql.IgniteSql;
-import org.apache.ignite.table.KeyValueView;
/**
* Enumeration of tables from TPC-H specification.
*/
-public enum TpchTables {
+@SuppressWarnings("NonSerializableFieldInSerializableClass")
+public enum TpchTables implements TpcTable {
LINEITEM(
new Column("L_ORDERKEY", INT32),
new Column("L_PARTKEY", INT32),
@@ -186,46 +186,28 @@ public enum TpchTables {
this.columns = columns;
}
- /** Returns name of the table. */
+ @Override
public String tableName() {
return name().toLowerCase();
}
- /** Returns number of column in the table. */
+ @Override
public int columnsCount() {
return columns.length;
}
+ @Override
public String columnName(int idx) {
return columns[idx].name;
}
- /** Returns definition of a table including necessary indexes. */
+ @Override
public String ddlScript() {
return TpchHelper.loadFromResource("tpch/ddl/" + tableName() + "_ddl.sql");
}
- /**
- * Returns DML string representing single-row INSERT statement with dynamic
- * parameters placeholders.
- *
- * <p>The order of columns matches the order specified in TPC-H specification
- * (see table declarations or output of {@link #ddlScript()}).
- *
- * <p>The statement returned is tolerant to columns' type mismatch, implying you
- * can use any value while there is cast from provided value to required type.
- */
- public abstract String insertPrepareStatement();
-
- /**
- * Returns iterator returning rows of the corresponding table.
- *
- * <p>May be used to fill the table via {@link KeyValueView KV API} or {@link IgniteSql SQL API}.
- *
- * @param pathToDataset A path to a directory with CSV file containing data for the table.
- * @return Iterator over data of the table.
- * @throws IOException In case of error.
- */
+ @SuppressWarnings("resource")
+ @Override
public Iterator<Object[]> dataProvider(Path pathToDataset) throws IOException {
return Files.lines(pathToDataset.resolve(tableName() + ".tbl"))
.map(this::csvLineToTableValues)
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/call_center.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/call_center.sql
new file mode 100644
index 0000000000..b2bd0c3c2b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/call_center.sql
@@ -0,0 +1,36 @@
+create table CALL_CENTER
+(
+ CC_CALL_CENTER_SK INTEGER not null,
+ CC_CALL_CENTER_ID VARCHAR(16) not null,
+ CC_REC_START_DATE DATE,
+ CC_REC_END_DATE DATE,
+ CC_CLOSED_DATE_SK INTEGER,
+ CC_OPEN_DATE_SK INTEGER,
+ CC_NAME VARCHAR(50),
+ CC_CLASS VARCHAR(50),
+ CC_EMPLOYEES INTEGER,
+ CC_SQ_FT INTEGER,
+ CC_HOURS VARCHAR(20),
+ CC_MANAGER VARCHAR(40),
+ CC_MKT_ID INTEGER,
+ CC_MKT_CLASS VARCHAR(50),
+ CC_MKT_DESC VARCHAR(100),
+ CC_MARKET_MANAGER VARCHAR(40),
+ CC_DIVISION INTEGER,
+ CC_DIVISION_NAME VARCHAR(50),
+ CC_COMPANY INTEGER,
+ CC_COMPANY_NAME VARCHAR(50),
+ CC_STREET_NUMBER VARCHAR(10),
+ CC_STREET_NAME VARCHAR(60),
+ CC_STREET_TYPE VARCHAR(15),
+ CC_SUITE_NUMBER VARCHAR(10),
+ CC_CITY VARCHAR(60),
+ CC_COUNTY VARCHAR(30),
+ CC_STATE VARCHAR(2),
+ CC_ZIP VARCHAR(10),
+ CC_COUNTRY VARCHAR(20),
+ CC_GMT_OFFSET NUMERIC(5, 2),
+ CC_TAX_PERCENTAGE NUMERIC(5, 2),
+ constraint CALL_CENTER_PK
+ primary key (CC_CALL_CENTER_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_page.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_page.sql
new file mode 100644
index 0000000000..abca2200ba
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_page.sql
@@ -0,0 +1,14 @@
+create table CATALOG_PAGE
+(
+ CP_CATALOG_PAGE_SK INTEGER not null,
+ CP_CATALOG_PAGE_ID VARCHAR(16),
+ CP_START_DATE_SK INTEGER,
+ CP_END_DATE_SK INTEGER,
+ CP_DEPARTMENT VARCHAR(50),
+ CP_CATALOG_NUMBER INTEGER,
+ CP_CATALOG_PAGE_NUMBER INTEGER,
+ CP_DESCRIPTION VARCHAR(100),
+ CP_TYPE VARCHAR(100),
+ constraint CATALOG_PAGE_PK
+ primary key (CP_CATALOG_PAGE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_returns.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_returns.sql
new file mode 100644
index 0000000000..eb339be383
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_returns.sql
@@ -0,0 +1,32 @@
+create table CATALOG_RETURNS
+(
+ CR_RETURNED_DATE_SK INTEGER,
+ CR_RETURNED_TIME_SK INTEGER,
+ CR_ITEM_SK INTEGER not null,
+ CR_REFUNDED_CUSTOMER_SK INTEGER,
+ CR_REFUNDED_CDEMO_SK INTEGER,
+ CR_REFUNDED_HDEMO_SK INTEGER,
+ CR_REFUNDED_ADDR_SK INTEGER,
+ CR_RETURNING_CUSTOMER_SK INTEGER,
+ CR_RETURNING_CDEMO_SK INTEGER,
+ CR_RETURNING_HDEMO_SK INTEGER,
+ CR_RETURNING_ADDR_SK INTEGER,
+ CR_CALL_CENTER_SK INTEGER,
+ CR_CATALOG_PAGE_SK INTEGER,
+ CR_SHIP_MODE_SK INTEGER,
+ CR_WAREHOUSE_SK INTEGER,
+ CR_REASON_SK INTEGER,
+ CR_ORDER_NUMBER INTEGER not null,
+ CR_RETURN_QUANTITY INTEGER,
+ CR_RETURN_AMOUNT NUMERIC(7, 2),
+ CR_RETURN_TAX NUMERIC(7, 2),
+ CR_RETURN_AMT_INC_TAX NUMERIC(7, 2),
+ CR_FEE NUMERIC(7, 2),
+ CR_RETURN_SHIP_COST NUMERIC(7, 2),
+ CR_REFUNDED_CASH NUMERIC(7, 2),
+ CR_REVERSED_CHARGE NUMERIC(7, 2),
+ CR_STORE_CREDIT NUMERIC(7, 2),
+ CR_NET_LOSS NUMERIC(7, 2),
+ constraint CATALOG_RETURNS_PK
+ primary key (CR_ITEM_SK, CR_ORDER_NUMBER)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_sales.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_sales.sql
new file mode 100644
index 0000000000..263607ab4b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/catalog_sales.sql
@@ -0,0 +1,39 @@
+create table CATALOG_SALES
+(
+ CS_SOLD_DATE_SK INTEGER,
+ CS_SOLD_TIME_SK INTEGER,
+ CS_SHIP_DATE_SK INTEGER,
+ CS_BILL_CUSTOMER_SK INTEGER,
+ CS_BILL_CDEMO_SK INTEGER,
+ CS_BILL_HDEMO_SK INTEGER,
+ CS_BILL_ADDR_SK INTEGER,
+ CS_SHIP_CUSTOMER_SK INTEGER,
+ CS_SHIP_CDEMO_SK INTEGER,
+ CS_SHIP_HDEMO_SK INTEGER,
+ CS_SHIP_ADDR_SK INTEGER,
+ CS_CALL_CENTER_SK INTEGER,
+ CS_CATALOG_PAGE_SK INTEGER,
+ CS_SHIP_MODE_SK INTEGER,
+ CS_WAREHOUSE_SK INTEGER,
+ CS_ITEM_SK INTEGER not null,
+ CS_PROMO_SK INTEGER,
+ CS_ORDER_NUMBER INTEGER not null,
+ CS_QUANTITY INTEGER,
+ CS_WHOLESALE_COST NUMERIC(7, 2),
+ CS_LIST_PRICE NUMERIC(7, 2),
+ CS_SALES_PRICE NUMERIC(7, 2),
+ CS_EXT_DISCOUNT_AMT NUMERIC(7, 2),
+ CS_EXT_SALES_PRICE NUMERIC(7, 2),
+ CS_EXT_WHOLESALE_COST NUMERIC(7, 2),
+ CS_EXT_LIST_PRICE NUMERIC(7, 2),
+ CS_EXT_TAX NUMERIC(7, 2),
+ CS_COUPON_AMT NUMERIC(7, 2),
+ CS_EXT_SHIP_COST NUMERIC(7, 2),
+ CS_NET_PAID NUMERIC(7, 2),
+ CS_NET_PAID_INC_TAX NUMERIC(7, 2),
+ CS_NET_PAID_INC_SHIP NUMERIC(7, 2),
+ CS_NET_PAID_INC_SHIP_TAX NUMERIC(7, 2),
+ CS_NET_PROFIT NUMERIC(7, 2),
+ constraint CATALOG_SALES_PK
+ primary key (CS_ITEM_SK, CS_ORDER_NUMBER)
+);
\ No newline at end of file
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer.sql
new file mode 100644
index 0000000000..3902deafe7
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer.sql
@@ -0,0 +1,23 @@
+create table CUSTOMER
+(
+ C_CUSTOMER_SK INTEGER not null,
+ C_CUSTOMER_ID VARCHAR(16) not null,
+ C_CURRENT_CDEMO_SK INTEGER,
+ C_CURRENT_HDEMO_SK INTEGER,
+ C_CURRENT_ADDR_SK INTEGER,
+ C_FIRST_SHIPTO_DATE_SK INTEGER,
+ C_FIRST_SALES_DATE_SK INTEGER,
+ C_SALUTATION VARCHAR(10),
+ C_FIRST_NAME VARCHAR(20),
+ C_LAST_NAME VARCHAR(30),
+ C_PREFERRED_CUST_FLAG VARCHAR,
+ C_BIRTH_DAY INTEGER,
+ C_BIRTH_MONTH INTEGER,
+ C_BIRTH_YEAR INTEGER,
+ C_BIRTH_COUNTRY VARCHAR(20),
+ C_LOGIN VARCHAR(13),
+ C_EMAIL_ADDRESS VARCHAR(50),
+ C_LAST_REVIEW_DATE_SK INTEGER,
+ constraint CUSTOMER_PK
+ primary key (C_CUSTOMER_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_address.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_address.sql
new file mode 100644
index 0000000000..7d901b0e46
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_address.sql
@@ -0,0 +1,18 @@
+create table CUSTOMER_ADDRESS
+(
+ CA_ADDRESS_SK INTEGER not null,
+ CA_ADDRESS_ID VARCHAR(16) not null,
+ CA_STREET_NUMBER VARCHAR(10),
+ CA_STREET_NAME VARCHAR(60),
+ CA_STREET_TYPE VARCHAR(15),
+ CA_SUITE_NUMBER VARCHAR(10),
+ CA_CITY VARCHAR(60),
+ CA_COUNTY VARCHAR(30),
+ CA_STATE VARCHAR(2),
+ CA_ZIP VARCHAR(10),
+ CA_COUNTRY VARCHAR(20),
+ CA_GMT_OFFSET NUMERIC(5, 2),
+ CA_LOCATION_TYPE VARCHAR(20),
+ constraint CUSTOMER_ADDRESS_PK
+ primary key (CA_ADDRESS_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_demographics.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_demographics.sql
new file mode 100644
index 0000000000..3b44776ca0
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/customer_demographics.sql
@@ -0,0 +1,14 @@
+create table CUSTOMER_DEMOGRAPHICS
+(
+ CD_DEMO_SK INTEGER not null,
+ CD_GENDER VARCHAR,
+ CD_MARITAL_STATUS VARCHAR,
+ CD_EDUCATION_STATUS VARCHAR(20),
+ CD_PURCHASE_ESTIMATE INTEGER,
+ CD_CREDIT_RATING VARCHAR(10),
+ CD_DEP_COUNT INTEGER,
+ CD_DEP_EMPLOYED_COUNT INTEGER,
+ CD_DEP_COLLEGE_COUNT INTEGER,
+ constraint CUSTOMER_DEMOGRAPHICS_PK
+ primary key (CD_DEMO_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/date_dim.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/date_dim.sql
new file mode 100644
index 0000000000..d4423bcddc
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/date_dim.sql
@@ -0,0 +1,33 @@
+create table DATE_DIM
+(
+ d_date_sk INTEGER not null,
+ d_date_id VARCHAR(16) not null,
+ d_date DATE,
+ d_month_seq INTEGER,
+ d_week_seq INTEGER,
+ d_quarter_seq INTEGER,
+ d_year INTEGER,
+ d_dow INTEGER,
+ d_moy INTEGER,
+ d_dom INTEGER,
+ d_qoy INTEGER,
+ d_fy_year INTEGER,
+ d_fy_quarter_seq INTEGER,
+ d_fy_week_seq INTEGER,
+ d_day_name VARCHAR(9),
+ d_quarter_name VARCHAR(6),
+ d_holiday VARCHAR(1),
+ d_weekend VARCHAR(1),
+ d_following_holiday VARCHAR(1),
+ d_first_dom INTEGER,
+ d_last_dom INTEGER,
+ d_same_day_ly INTEGER,
+ d_same_day_lq INTEGER,
+ d_current_day VARCHAR(1),
+ d_current_week VARCHAR(1),
+ d_current_month VARCHAR(1),
+ d_current_quarter VARCHAR(1),
+ d_current_year VARCHAR(1),
+ constraint DATE_DIM_pk
+ primary key (d_date_sk)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/household_demographics.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/household_demographics.sql
new file mode 100644
index 0000000000..dbea559027
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/household_demographics.sql
@@ -0,0 +1,10 @@
+create table HOUSEHOLD_DEMOGRAPHICS
+(
+ HD_DEMO_SK INTEGER not null,
+ HD_INCOME_BAND_SK INTEGER,
+ HD_BUY_POTENTIAL VARCHAR(15),
+ HD_DEP_COUNT INTEGER,
+ HD_VEHICLE_COUNT INTEGER,
+ constraint HOUSEHOLD_DEMOGRAPHICS_PK
+ primary key (HD_DEMO_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/income_band.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/income_band.sql
new file mode 100644
index 0000000000..cce3cba4b7
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/income_band.sql
@@ -0,0 +1,8 @@
+create table INCOME_BAND
+(
+ IB_INCOME_BAND_SK INTEGER not null,
+ IB_LOWER_BOUND INTEGER,
+ IB_UPPER_BOUND INTEGER,
+ constraint INCOME_BAND_PK
+ primary key (IB_INCOME_BAND_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/inventory.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/inventory.sql
new file mode 100644
index 0000000000..f78687761d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/inventory.sql
@@ -0,0 +1,9 @@
+create table INVENTORY
+(
+ INV_DATE_SK INTEGER not null,
+ INV_ITEM_SK INTEGER not null,
+ INV_WAREHOUSE_SK INTEGER not null,
+ INV_QUANTITY_ON_HAND INTEGER,
+ constraint INVENTORY_PK
+ primary key (INV_DATE_SK, INV_ITEM_SK, INV_WAREHOUSE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/item.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/item.sql
new file mode 100644
index 0000000000..371382b083
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/item.sql
@@ -0,0 +1,27 @@
+create table ITEM
+(
+ I_ITEM_SK INTEGER not null,
+ I_ITEM_ID VARCHAR(16) not null,
+ I_REC_START_DATE DATE,
+ I_REC_END_DATE DATE,
+ I_ITEM_DESC VARCHAR(200),
+ I_CURRENT_PRICE NUMERIC(7, 2),
+ I_WHOLESALE_COST NUMERIC(7, 2),
+ I_BRAND_ID INTEGER,
+ I_BRAND VARCHAR(50),
+ I_CLASS_ID INTEGER,
+ I_CLASS VARCHAR(50),
+ I_CATEGORY_ID INTEGER,
+ I_CATEGORY VARCHAR(50),
+ I_MANUFACT_ID INTEGER,
+ I_MANUFACT VARCHAR(50),
+ I_SIZE VARCHAR(20),
+ I_FORMULATION VARCHAR(20),
+ I_COLOR VARCHAR(20),
+ I_UNITS VARCHAR(10),
+ I_CONTAINER VARCHAR(10),
+ I_MANAGER_ID INTEGER,
+ I_PRODUCT_NAME VARCHAR(50),
+ constraint ITEM_PK
+ primary key (I_ITEM_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/promotion.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/promotion.sql
new file mode 100644
index 0000000000..d67ae9e17f
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/promotion.sql
@@ -0,0 +1,24 @@
+create table PROMOTION
+(
+ P_PROMO_SK INTEGER not null,
+ P_PROMO_ID VARCHAR(16),
+ P_START_DATE_SK INTEGER,
+ P_END_DATE_SK INTEGER,
+ P_ITEM_SK INTEGER,
+ P_COST NUMERIC(15, 2),
+ P_RESPONSE_TARGET INTEGER,
+ P_PROMO_NAME VARCHAR(50),
+ P_CHANNEL_DMAIL VARCHAR,
+ P_CHANNEL_EMAIL VARCHAR,
+ P_CHANNEL_CATALOG VARCHAR,
+ P_CHANNEL_TV VARCHAR,
+ P_CHANNEL_RADIO VARCHAR,
+ P_CHANNEL_PRESS VARCHAR,
+ P_CHANNEL_EVENT VARCHAR,
+ P_CHANNEL_DEMO VARCHAR,
+ P_CHANNEL_DETAILS VARCHAR(100),
+ P_PURPOSE VARCHAR(15),
+ P_DISCOUNT_ACTIVE VARCHAR,
+ constraint PROMOTION_PK
+ primary key (P_PROMO_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/reason.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/reason.sql
new file mode 100644
index 0000000000..8d030bf565
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/reason.sql
@@ -0,0 +1,8 @@
+create table REASON
+(
+ R_REASON_SK INTEGER not null,
+ R_REASON_ID VARCHAR(16),
+ R_REASON_DESC VARCHAR(100),
+ constraint REASON_PK
+ primary key (R_REASON_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/ship_mode.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/ship_mode.sql
new file mode 100644
index 0000000000..0b00746f11
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/ship_mode.sql
@@ -0,0 +1,11 @@
+create table SHIP_MODE
+(
+ SM_SHIP_MODE_SK INTEGER not null,
+ SM_SHIP_MODE_ID VARCHAR(16),
+ SM_TYPE VARCHAR(30),
+ SM_CODE VARCHAR(10),
+ SM_CARRIER VARCHAR(20),
+ SM_CONTRACT VARCHAR(20),
+ constraint SHIP_MODE_PK
+ primary key (SM_SHIP_MODE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store.sql
new file mode 100644
index 0000000000..465a0171e9
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store.sql
@@ -0,0 +1,34 @@
+create table STORE
+(
+ S_STORE_SK INTEGER not null,
+ S_STORE_ID VARCHAR(16) not null,
+ S_REC_START_DATE DATE,
+ S_REC_END_DATE DATE,
+ S_CLOSED_DATE_SK INTEGER,
+ S_STORE_NAME VARCHAR(50),
+ S_NUMBER_EMPLOYEES INTEGER,
+ S_FLOOR_SPACE INTEGER,
+ S_HOURS VARCHAR(20),
+ S_MANAGER VARCHAR(40),
+ S_MARKET_ID INTEGER,
+ S_GEOGRAPHY_CLASS VARCHAR(100),
+ S_MARKET_DESC VARCHAR(100),
+ S_MARKET_MANAGER VARCHAR(40),
+ S_DIVISION_ID INTEGER,
+ S_DIVISION_NAME VARCHAR(50),
+ S_COMPANY_ID INTEGER,
+ S_COMPANY_NAME VARCHAR(50),
+ S_STREET_NUMBER VARCHAR(10),
+ S_STREET_NAME VARCHAR(60),
+ S_STREET_TYPE VARCHAR(15),
+ S_SUITE_NUMBER VARCHAR(10),
+ S_CITY VARCHAR(60),
+ S_COUNTY VARCHAR(30),
+ S_STATE VARCHAR(2),
+ S_ZIP VARCHAR(10),
+ S_COUNTRY VARCHAR(20),
+ S_GMT_OFFSET NUMERIC(5, 2),
+ S_TAX_PERCENTAGE NUMERIC(5, 2),
+ constraint STORE_PK
+ primary key (S_STORE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_returns.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_returns.sql
new file mode 100644
index 0000000000..160a71c2ac
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_returns.sql
@@ -0,0 +1,25 @@
+create table STORE_RETURNS
+(
+ SR_RETURNED_DATE_SK INTEGER,
+ SR_RETURN_TIME_SK INTEGER,
+ SR_ITEM_SK INTEGER not null,
+ SR_CUSTOMER_SK INTEGER,
+ SR_CDEMO_SK INTEGER,
+ SR_HDEMO_SK INTEGER,
+ SR_ADDR_SK INTEGER,
+ SR_STORE_SK INTEGER,
+ SR_REASON_SK INTEGER,
+ SR_TICKET_NUMBER INTEGER not null,
+ SR_RETURN_QUANTITY INTEGER,
+ SR_RETURN_AMT NUMERIC(7, 2),
+ SR_RETURN_TAX NUMERIC(7, 2),
+ SR_RETURN_AMT_INC_TAX NUMERIC(7, 2),
+ SR_FEE NUMERIC(7, 2),
+ SR_RETURN_SHIP_COST NUMERIC(7, 2),
+ SR_REFUNDED_CASH NUMERIC(7, 2),
+ SR_REVERSED_CHARGE NUMERIC(7, 2),
+ SR_STORE_CREDIT NUMERIC(7, 2),
+ SR_NET_LOSS NUMERIC(7, 2),
+ constraint SR_ITEM_SK
+ primary key (SR_ITEM_SK, SR_TICKET_NUMBER)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_sales.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_sales.sql
new file mode 100644
index 0000000000..1ee5aaa7de
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/store_sales.sql
@@ -0,0 +1,28 @@
+create table STORE_SALES
+(
+ SS_SOLD_DATE_SK INTEGER,
+ SS_SOLD_TIME_SK INTEGER,
+ SS_ITEM_SK INTEGER not null,
+ SS_CUSTOMER_SK INTEGER,
+ SS_CDEMO_SK INTEGER,
+ SS_HDEMO_SK INTEGER,
+ SS_ADDR_SK INTEGER,
+ SS_STORE_SK INTEGER,
+ SS_PROMO_SK INTEGER,
+ SS_TICKET_NUMBER INTEGER not null,
+ SS_QUANTITY INTEGER,
+ SS_WHOLESALE_COST NUMERIC(7, 2),
+ SS_LIST_PRICE NUMERIC(7, 2),
+ SS_SALES_PRICE NUMERIC(7, 2),
+ SS_EXT_DISCOUNT_AMT NUMERIC(7, 2),
+ SS_EXT_SALES_PRICE NUMERIC(7, 2),
+ SS_EXT_WHOLESALE_COST NUMERIC(7, 2),
+ SS_EXT_LIST_PRICE NUMERIC(7, 2),
+ SS_EXT_TAX NUMERIC(7, 2),
+ SS_COUPON_AMT NUMERIC(7, 2),
+ SS_NET_PAID NUMERIC(7, 2),
+ SS_NET_PAID_INC_TAX NUMERIC(7, 2),
+ SS_NET_PROFIT NUMERIC(7, 2),
+ constraint SS_ITEM_SK
+ primary key (SS_ITEM_SK, SS_TICKET_NUMBER)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/time_dim.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/time_dim.sql
new file mode 100644
index 0000000000..5202ed57e6
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/time_dim.sql
@@ -0,0 +1,15 @@
+create table TIME_DIM
+(
+ T_TIME_SK INTEGER not null,
+ T_TIME_ID VARCHAR(16) not null,
+ T_TIME INTEGER not null,
+ T_HOUR INTEGER,
+ T_MINUTE INTEGER,
+ T_SECOND INTEGER,
+ T_AM_PM VARCHAR(2),
+ T_SHIFT VARCHAR(20),
+ T_SUB_SHIFT VARCHAR(20),
+ T_MEAL_TIME VARCHAR(20),
+ constraint TIME_DIM_PK
+ primary key (T_TIME_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/warehouse.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/warehouse.sql
new file mode 100644
index 0000000000..668908b928
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/warehouse.sql
@@ -0,0 +1,19 @@
+create table WAREHOUSE
+(
+ W_WAREHOUSE_SK INTEGER not null,
+ W_WAREHOUSE_ID VARCHAR(16) not null,
+ W_WAREHOUSE_NAME VARCHAR(20),
+ W_WAREHOUSE_SQ_FT INTEGER,
+ W_STREET_NUMBER VARCHAR(10),
+ W_STREET_NAME VARCHAR(60),
+ W_STREET_TYPE VARCHAR(15),
+ W_SUITE_NUMBER VARCHAR(10),
+ W_CITY VARCHAR(60),
+ W_COUNTY VARCHAR(30),
+ W_STATE VARCHAR(2),
+ W_ZIP VARCHAR(10),
+ W_COUNTRY VARCHAR(20),
+ W_GMT_OFFSET NUMERIC(5, 2),
+ constraint WAREHOUSE_PK
+ primary key (W_WAREHOUSE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_page.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_page.sql
new file mode 100644
index 0000000000..20e1e31d64
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_page.sql
@@ -0,0 +1,19 @@
+create table WEB_PAGE
+(
+ WP_WEB_PAGE_SK INTEGER not null,
+ WP_WEB_PAGE_ID VARCHAR(16) not null,
+ WP_REC_START_DATE DATE,
+ WP_REC_END_DATE DATE,
+ WP_CREATION_DATE_SK INTEGER,
+ WP_ACCESS_DATE_SK INTEGER,
+ WP_AUTOGEN_FLAG VARCHAR,
+ WP_CUSTOMER_SK INTEGER,
+ WP_URL VARCHAR(100),
+ WP_TYPE VARCHAR(50),
+ WP_CHAR_COUNT INTEGER,
+ WP_LINK_COUNT INTEGER,
+ WP_IMAGE_COUNT INTEGER,
+ WP_MAX_AD_COUNT INTEGER,
+ constraint WEB_PAGE_PK
+ primary key (WP_WEB_PAGE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_returns.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_returns.sql
new file mode 100644
index 0000000000..6911e97eac
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_returns.sql
@@ -0,0 +1,29 @@
+create table WEB_RETURNS
+(
+ WR_RETURNED_DATE_SK INTEGER,
+ WR_RETURNED_TIME_SK INTEGER,
+ WR_ITEM_SK INTEGER not null,
+ WR_REFUNDED_CUSTOMER_SK INTEGER,
+ WR_REFUNDED_CDEMO_SK INTEGER,
+ WR_REFUNDED_HDEMO_SK INTEGER,
+ WR_REFUNDED_ADDR_SK INTEGER,
+ WR_RETURNING_CUSTOMER_SK INTEGER,
+ WR_RETURNING_CDEMO_SK INTEGER,
+ WR_RETURNING_HDEMO_SK INTEGER,
+ WR_RETURNING_ADDR_SK INTEGER,
+ WR_WEB_PAGE_SK INTEGER,
+ WR_REASON_SK INTEGER,
+ WR_ORDER_NUMBER INTEGER not null,
+ WR_RETURN_QUANTITY INTEGER,
+ WR_RETURN_AMT NUMERIC(7, 2),
+ WR_RETURN_TAX NUMERIC(7, 2),
+ WR_RETURN_AMT_INC_TAX NUMERIC(7, 2),
+ WR_FEE NUMERIC(7, 2),
+ WR_RETURN_SHIP_COST NUMERIC(7, 2),
+ WR_REFUNDED_CASH NUMERIC(7, 2),
+ WR_REVERSED_CHARGE NUMERIC(7, 2),
+ WR_ACCOUNT_CREDIT NUMERIC(7, 2),
+ WR_NET_LOSS NUMERIC(7, 2),
+ constraint WEB_RETURNS_PK
+ primary key (WR_ITEM_SK, WR_ORDER_NUMBER)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_sales.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_sales.sql
new file mode 100644
index 0000000000..841385f6f3
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_sales.sql
@@ -0,0 +1,39 @@
+create table WEB_SALES
+(
+ WS_SOLD_DATE_SK INTEGER,
+ WS_SOLD_TIME_SK INTEGER,
+ WS_SHIP_DATE_SK INTEGER,
+ WS_ITEM_SK INTEGER not null,
+ WS_BILL_CUSTOMER_SK INTEGER,
+ WS_BILL_CDEMO_SK INTEGER,
+ WS_BILL_HDEMO_SK INTEGER,
+ WS_BILL_ADDR_SK INTEGER,
+ WS_SHIP_CUSTOMER_SK INTEGER,
+ WS_SHIP_CDEMO_SK INTEGER,
+ WS_SHIP_HDEMO_SK INTEGER,
+ WS_SHIP_ADDR_SK INTEGER,
+ WS_WEB_PAGE_SK INTEGER,
+ WS_WEB_SITE_SK INTEGER,
+ WS_SHIP_MODE_SK INTEGER,
+ WS_WAREHOUSE_SK INTEGER,
+ WS_PROMO_SK INTEGER,
+ WS_ORDER_NUMBER INTEGER not null,
+ WS_QUANTITY INTEGER,
+ WS_WHOLESALE_COST NUMERIC(7, 2),
+ WS_LIST_PRICE NUMERIC(7, 2),
+ WS_SALES_PRICE NUMERIC(7, 2),
+ WS_EXT_DISCOUNT_AMT NUMERIC(7, 2),
+ WS_EXT_SALES_PRICE NUMERIC(7, 2),
+ WS_EXT_WHOLESALE_COST NUMERIC(7, 2),
+ WS_EXT_LIST_PRICE NUMERIC(7, 2),
+ WS_EXT_TAX NUMERIC(7, 2),
+ WS_COUPON_AMT NUMERIC(7, 2),
+ WS_EXT_SHIP_COST NUMERIC(7, 2),
+ WS_NET_PAID NUMERIC(7, 2),
+ WS_NET_PAID_INC_TAX NUMERIC(7, 2),
+ WS_NET_PAID_INC_SHIP NUMERIC(7, 2),
+ WS_NET_PAID_INC_SHIP_TAX NUMERIC(7, 2),
+ WS_NET_PROFIT NUMERIC(7, 2),
+ constraint WEB_SALES_PK
+ primary key (WS_ITEM_SK, WS_ORDER_NUMBER)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_site.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_site.sql
new file mode 100644
index 0000000000..7e967098af
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/ddl/web_site.sql
@@ -0,0 +1,31 @@
+create table WEB_SITE
+(
+ WEB_SITE_SK INTEGER not null,
+ WEB_SITE_ID VARCHAR(16) not null,
+ WEB_REC_START_DATE DATE,
+ WEB_REC_END_DATE DATE,
+ WEB_NAME VARCHAR(50),
+ WEB_OPEN_DATE_SK INTEGER,
+ WEB_CLOSE_DATE_SK INTEGER,
+ WEB_CLASS VARCHAR(50),
+ WEB_MANAGER VARCHAR(40),
+ WEB_MKT_ID INTEGER,
+ WEB_MKT_CLASS VARCHAR(50),
+ WEB_MKT_DESC VARCHAR(100),
+ WEB_MARKET_MANAGER VARCHAR(40),
+ WEB_COMPANY_ID INTEGER,
+ WEB_COMPANY_NAME VARCHAR(50),
+ WEB_STREET_NUMBER VARCHAR(10),
+ WEB_STREET_NAME VARCHAR(60),
+ WEB_STREET_TYPE VARCHAR(15),
+ WEB_SUITE_NUMBER VARCHAR(10),
+ WEB_CITY VARCHAR(60),
+ WEB_COUNTY VARCHAR(30),
+ WEB_STATE VARCHAR(2),
+ WEB_ZIP VARCHAR(10),
+ WEB_COUNTRY VARCHAR(20),
+ WEB_GMT_OFFSET NUMERIC(5, 2),
+ WEB_TAX_PERCENTAGE NUMERIC(5, 2),
+ constraint WEB_SITE_PK
+ primary key (WEB_SITE_SK)
+);
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query1.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query1.sql
new file mode 100644
index 0000000000..c299360c3c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query1.sql
@@ -0,0 +1,24 @@
+-- start query 1 in stream 0 using template query1.tpl and seed 2031708268
+with customer_total_return as
+(select sr_customer_sk as ctr_customer_sk
+,sr_store_sk as ctr_store_sk
+,sum(SR_FEE) as ctr_total_return
+from store_returns
+,date_dim
+where sr_returned_date_sk = d_date_sk
+and d_year =2000
+group by sr_customer_sk, sr_store_sk)
+select c_customer_id
+from customer_total_return ctr1
+,store
+,customer
+where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
+from customer_total_return ctr2
+where ctr1.ctr_store_sk = ctr2.ctr_store_sk)
+and s_store_sk = ctr1.ctr_store_sk
+and s_state = 'NM'
+and ctr1.ctr_customer_sk = c_customer_sk
+order by c_customer_id
+limit 100;
+
+-- end query 1 in stream 0 using template query1.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query10.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query10.sql
new file mode 100644
index 0000000000..c5b4ac2476
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query10.sql
@@ -0,0 +1,59 @@
+-- start query 1 in stream 0 using template query10.tpl and seed 797269820
+select
+ cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ count(*) cnt1,
+ cd_purchase_estimate,
+ count(*) cnt2,
+ cd_credit_rating,
+ count(*) cnt3,
+ cd_dep_count,
+ count(*) cnt4,
+ cd_dep_employed_count,
+ count(*) cnt5,
+ cd_dep_college_count,
+ count(*) cnt6
+ from
+ customer c,customer_address ca,customer_demographics
+ where
+ c.c_current_addr_sk = ca.ca_address_sk and
+ ca_county in ('Fillmore County','McPherson County','Bonneville County','Boone County','Brown County') and
+ cd_demo_sk = c.c_current_cdemo_sk and
+ exists (select *
+ from store_sales,date_dim
+ where c.c_customer_sk = ss_customer_sk and
+ ss_sold_date_sk = d_date_sk and
+ d_year = 2000 and
+ d_moy between 3 and 3+3) and
+ (exists (select *
+ from web_sales,date_dim
+ where c.c_customer_sk = ws_bill_customer_sk and
+ ws_sold_date_sk = d_date_sk and
+ d_year = 2000 and
+ d_moy between 3 ANd 3+3) or
+ exists (select *
+ from catalog_sales,date_dim
+ where c.c_customer_sk = cs_ship_customer_sk and
+ cs_sold_date_sk = d_date_sk and
+ d_year = 2000 and
+ d_moy between 3 and 3+3))
+ group by cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ cd_purchase_estimate,
+ cd_credit_rating,
+ cd_dep_count,
+ cd_dep_employed_count,
+ cd_dep_college_count
+ order by cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ cd_purchase_estimate,
+ cd_credit_rating,
+ cd_dep_count,
+ cd_dep_employed_count,
+ cd_dep_college_count
+limit 100;
+
+-- end query 1 in stream 0 using template query10.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query11.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query11.sql
new file mode 100644
index 0000000000..156d9da5e6
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query11.sql
@@ -0,0 +1,81 @@
+-- start query 1 in stream 0 using template query11.tpl and seed 1819994127
+with year_total as (
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,c_preferred_cust_flag customer_preferred_cust_flag
+ ,c_birth_country customer_birth_country
+ ,c_login customer_login
+ ,c_email_address customer_email_address
+ ,d_year dyear
+ ,sum(ss_ext_list_price-ss_ext_discount_amt) year_total
+ ,'s' sale_type
+ from customer
+ ,store_sales
+ ,date_dim
+ where c_customer_sk = ss_customer_sk
+ and ss_sold_date_sk = d_date_sk
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,c_preferred_cust_flag
+ ,c_birth_country
+ ,c_login
+ ,c_email_address
+ ,d_year
+ union all
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,c_preferred_cust_flag customer_preferred_cust_flag
+ ,c_birth_country customer_birth_country
+ ,c_login customer_login
+ ,c_email_address customer_email_address
+ ,d_year dyear
+ ,sum(ws_ext_list_price-ws_ext_discount_amt) year_total
+ ,'w' sale_type
+ from customer
+ ,web_sales
+ ,date_dim
+ where c_customer_sk = ws_bill_customer_sk
+ and ws_sold_date_sk = d_date_sk
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,c_preferred_cust_flag
+ ,c_birth_country
+ ,c_login
+ ,c_email_address
+ ,d_year
+ )
+ select
+ t_s_secyear.customer_id
+ ,t_s_secyear.customer_first_name
+ ,t_s_secyear.customer_last_name
+ ,t_s_secyear.customer_birth_country
+ from year_total t_s_firstyear
+ ,year_total t_s_secyear
+ ,year_total t_w_firstyear
+ ,year_total t_w_secyear
+ where t_s_secyear.customer_id = t_s_firstyear.customer_id
+ and t_s_firstyear.customer_id = t_w_secyear.customer_id
+ and t_s_firstyear.customer_id = t_w_firstyear.customer_id
+ and t_s_firstyear.sale_type = 's'
+ and t_w_firstyear.sale_type = 'w'
+ and t_s_secyear.sale_type = 's'
+ and t_w_secyear.sale_type = 'w'
+ and t_s_firstyear.dyear = 1999
+ and t_s_secyear.dyear = 1999+1
+ and t_w_firstyear.dyear = 1999
+ and t_w_secyear.dyear = 1999+1
+ and t_s_firstyear.year_total > 0
+ and t_w_firstyear.year_total > 0
+ and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else 0.0 end
+ > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else 0.0 end
+ order by t_s_secyear.customer_id
+ ,t_s_secyear.customer_first_name
+ ,t_s_secyear.customer_last_name
+ ,t_s_secyear.customer_birth_country
+limit 100;
+
+-- end query 1 in stream 0 using template query11.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query12.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query12.sql
new file mode 100644
index 0000000000..3267c96759
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query12.sql
@@ -0,0 +1,34 @@
+-- start query 1 in stream 0 using template query12.tpl and seed 345591136
+select i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+ ,sum(ws_ext_sales_price) as itemrevenue
+ ,sum(ws_ext_sales_price)*100/sum(sum(ws_ext_sales_price)) over
+ (partition by i_class) as revenueratio
+from
+ web_sales
+ ,item
+ ,date_dim
+where
+ ws_item_sk = i_item_sk
+ and i_category in ('Electronics', 'Books', 'Women')
+ and ws_sold_date_sk = d_date_sk
+ and d_date between cast('1998-01-06' as date)
+ and (cast('1998-01-06' as date) + 30 days)
+group by
+ i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+order by
+ i_category
+ ,i_class
+ ,i_item_id
+ ,i_item_desc
+ ,revenueratio
+limit 100;
+
+-- end query 1 in stream 0 using template query12.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query13.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query13.sql
new file mode 100644
index 0000000000..cdef846605
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query13.sql
@@ -0,0 +1,52 @@
+-- start query 1 in stream 0 using template query13.tpl and seed 622697896
+select avg(ss_quantity)
+ ,avg(ss_ext_sales_price)
+ ,avg(ss_ext_wholesale_cost)
+ ,sum(ss_ext_wholesale_cost)
+ from store_sales
+ ,store
+ ,customer_demographics
+ ,household_demographics
+ ,customer_address
+ ,date_dim
+ where s_store_sk = ss_store_sk
+ and ss_sold_date_sk = d_date_sk and d_year = 2001
+ and((ss_hdemo_sk=hd_demo_sk
+ and cd_demo_sk = ss_cdemo_sk
+ and cd_marital_status = 'U'
+ and cd_education_status = 'Secondary'
+ and ss_sales_price between 100.00 and 150.00
+ and hd_dep_count = 3
+ )or
+ (ss_hdemo_sk=hd_demo_sk
+ and cd_demo_sk = ss_cdemo_sk
+ and cd_marital_status = 'W'
+ and cd_education_status = 'College'
+ and ss_sales_price between 50.00 and 100.00
+ and hd_dep_count = 1
+ ) or
+ (ss_hdemo_sk=hd_demo_sk
+ and cd_demo_sk = ss_cdemo_sk
+ and cd_marital_status = 'D'
+ and cd_education_status = 'Primary'
+ and ss_sales_price between 150.00 and 200.00
+ and hd_dep_count = 1
+ ))
+ and((ss_addr_sk = ca_address_sk
+ and ca_country = 'United States'
+ and ca_state in ('TX', 'OK', 'MI')
+ and ss_net_profit between 100 and 200
+ ) or
+ (ss_addr_sk = ca_address_sk
+ and ca_country = 'United States'
+ and ca_state in ('WA', 'NC', 'OH')
+ and ss_net_profit between 150 and 300
+ ) or
+ (ss_addr_sk = ca_address_sk
+ and ca_country = 'United States'
+ and ca_state in ('MT', 'FL', 'GA')
+ and ss_net_profit between 50 and 250
+ ))
+;
+
+-- end query 1 in stream 0 using template query13.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query14.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query14.sql
new file mode 100644
index 0000000000..923814404f
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query14.sql
@@ -0,0 +1,210 @@
+-- start query 1 in stream 0 using template query14.tpl and seed 1819994127
+with cross_items as
+ (select i_item_sk ss_item_sk
+ from item,
+ (select iss.i_brand_id brand_id
+ ,iss.i_class_id class_id
+ ,iss.i_category_id category_id
+ from store_sales
+ ,item iss
+ ,date_dim d1
+ where ss_item_sk = iss.i_item_sk
+ and ss_sold_date_sk = d1.d_date_sk
+ and d1.d_year between 2000 AND 2000 + 2
+ intersect
+ select ics.i_brand_id
+ ,ics.i_class_id
+ ,ics.i_category_id
+ from catalog_sales
+ ,item ics
+ ,date_dim d2
+ where cs_item_sk = ics.i_item_sk
+ and cs_sold_date_sk = d2.d_date_sk
+ and d2.d_year between 2000 AND 2000 + 2
+ intersect
+ select iws.i_brand_id
+ ,iws.i_class_id
+ ,iws.i_category_id
+ from web_sales
+ ,item iws
+ ,date_dim d3
+ where ws_item_sk = iws.i_item_sk
+ and ws_sold_date_sk = d3.d_date_sk
+ and d3.d_year between 2000 AND 2000 + 2) x
+ where i_brand_id = brand_id
+ and i_class_id = class_id
+ and i_category_id = category_id
+),
+ avg_sales as
+ (select avg(quantity*list_price) average_sales
+ from (select ss_quantity quantity
+ ,ss_list_price list_price
+ from store_sales
+ ,date_dim
+ where ss_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2
+ union all
+ select cs_quantity quantity
+ ,cs_list_price list_price
+ from catalog_sales
+ ,date_dim
+ where cs_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2
+ union all
+ select ws_quantity quantity
+ ,ws_list_price list_price
+ from web_sales
+ ,date_dim
+ where ws_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2) x)
+ select channel, i_brand_id,i_class_id,i_category_id,sum(sales), sum(number_sales)
+ from(
+ select 'store' channel, i_brand_id,i_class_id
+ ,i_category_id,sum(ss_quantity*ss_list_price) sales
+ , count(*) number_sales
+ from store_sales
+ ,item
+ ,date_dim
+ where ss_item_sk in (select ss_item_sk from cross_items)
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year = 2000+2
+ and d_moy = 11
+ group by i_brand_id,i_class_id,i_category_id
+ having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)
+ union all
+ select 'catalog' channel, i_brand_id,i_class_id,i_category_id, sum(cs_quantity*cs_list_price) sales, count(*) number_sales
+ from catalog_sales
+ ,item
+ ,date_dim
+ where cs_item_sk in (select ss_item_sk from cross_items)
+ and cs_item_sk = i_item_sk
+ and cs_sold_date_sk = d_date_sk
+ and d_year = 2000+2
+ and d_moy = 11
+ group by i_brand_id,i_class_id,i_category_id
+ having sum(cs_quantity*cs_list_price) > (select average_sales from avg_sales)
+ union all
+ select 'web' channel, i_brand_id,i_class_id,i_category_id, sum(ws_quantity*ws_list_price) sales , count(*) number_sales
+ from web_sales
+ ,item
+ ,date_dim
+ where ws_item_sk in (select ss_item_sk from cross_items)
+ and ws_item_sk = i_item_sk
+ and ws_sold_date_sk = d_date_sk
+ and d_year = 2000+2
+ and d_moy = 11
+ group by i_brand_id,i_class_id,i_category_id
+ having sum(ws_quantity*ws_list_price) > (select average_sales from avg_sales)
+ ) y
+ group by rollup (channel, i_brand_id,i_class_id,i_category_id)
+ order by channel,i_brand_id,i_class_id,i_category_id
+ limit 100;
+with cross_items as
+ (select i_item_sk ss_item_sk
+ from item,
+ (select iss.i_brand_id brand_id
+ ,iss.i_class_id class_id
+ ,iss.i_category_id category_id
+ from store_sales
+ ,item iss
+ ,date_dim d1
+ where ss_item_sk = iss.i_item_sk
+ and ss_sold_date_sk = d1.d_date_sk
+ and d1.d_year between 2000 AND 2000 + 2
+ intersect
+ select ics.i_brand_id
+ ,ics.i_class_id
+ ,ics.i_category_id
+ from catalog_sales
+ ,item ics
+ ,date_dim d2
+ where cs_item_sk = ics.i_item_sk
+ and cs_sold_date_sk = d2.d_date_sk
+ and d2.d_year between 2000 AND 2000 + 2
+ intersect
+ select iws.i_brand_id
+ ,iws.i_class_id
+ ,iws.i_category_id
+ from web_sales
+ ,item iws
+ ,date_dim d3
+ where ws_item_sk = iws.i_item_sk
+ and ws_sold_date_sk = d3.d_date_sk
+ and d3.d_year between 2000 AND 2000 + 2) x
+ where i_brand_id = brand_id
+ and i_class_id = class_id
+ and i_category_id = category_id
+),
+ avg_sales as
+(select avg(quantity*list_price) average_sales
+ from (select ss_quantity quantity
+ ,ss_list_price list_price
+ from store_sales
+ ,date_dim
+ where ss_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2
+ union all
+ select cs_quantity quantity
+ ,cs_list_price list_price
+ from catalog_sales
+ ,date_dim
+ where cs_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2
+ union all
+ select ws_quantity quantity
+ ,ws_list_price list_price
+ from web_sales
+ ,date_dim
+ where ws_sold_date_sk = d_date_sk
+ and d_year between 2000 and 2000 + 2) x)
+ select this_year.channel ty_channel
+ ,this_year.i_brand_id ty_brand
+ ,this_year.i_class_id ty_class
+ ,this_year.i_category_id ty_category
+ ,this_year.sales ty_sales
+ ,this_year.number_sales ty_number_sales
+ ,last_year.channel ly_channel
+ ,last_year.i_brand_id ly_brand
+ ,last_year.i_class_id ly_class
+ ,last_year.i_category_id ly_category
+ ,last_year.sales ly_sales
+ ,last_year.number_sales ly_number_sales
+ from
+ (select 'store' channel, i_brand_id,i_class_id,i_category_id
+ ,sum(ss_quantity*ss_list_price) sales, count(*) number_sales
+ from store_sales
+ ,item
+ ,date_dim
+ where ss_item_sk in (select ss_item_sk from cross_items)
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_week_seq = (select d_week_seq
+ from date_dim
+ where d_year = 2000 + 1
+ and d_moy = 12
+ and d_dom = 15)
+ group by i_brand_id,i_class_id,i_category_id
+ having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)) this_year,
+ (select 'store' channel, i_brand_id,i_class_id
+ ,i_category_id, sum(ss_quantity*ss_list_price) sales, count(*) number_sales
+ from store_sales
+ ,item
+ ,date_dim
+ where ss_item_sk in (select ss_item_sk from cross_items)
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_week_seq = (select d_week_seq
+ from date_dim
+ where d_year = 2000
+ and d_moy = 12
+ and d_dom = 15)
+ group by i_brand_id,i_class_id,i_category_id
+ having sum(ss_quantity*ss_list_price) > (select average_sales from avg_sales)) last_year
+ where this_year.i_brand_id= last_year.i_brand_id
+ and this_year.i_class_id = last_year.i_class_id
+ and this_year.i_category_id = last_year.i_category_id
+ order by this_year.channel, this_year.i_brand_id, this_year.i_class_id, this_year.i_category_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query14.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query15.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query15.sql
new file mode 100644
index 0000000000..cb489cf33f
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query15.sql
@@ -0,0 +1,20 @@
+-- start query 1 in stream 0 using template query15.tpl and seed 1819994127
+select ca_zip
+ ,sum(cs_sales_price)
+ from catalog_sales
+ ,customer
+ ,customer_address
+ ,date_dim
+ where cs_bill_customer_sk = c_customer_sk
+ and c_current_addr_sk = ca_address_sk
+ and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475',
+ '85392', '85460', '80348', '81792')
+ or ca_state in ('CA','WA','GA')
+ or cs_sales_price > 500)
+ and cs_sold_date_sk = d_date_sk
+ and d_qoy = 2 and d_year = 1998
+ group by ca_zip
+ order by ca_zip
+ limit 100;
+
+-- end query 1 in stream 0 using template query15.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query16.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query16.sql
new file mode 100644
index 0000000000..affb71eb24
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query16.sql
@@ -0,0 +1,31 @@
+-- start query 1 in stream 0 using template query16.tpl and seed 171719422
+select
+ count(distinct cs_order_number) as `order count`
+ ,sum(cs_ext_ship_cost) as `total shipping cost`
+ ,sum(cs_net_profit) as `total net profit`
+from
+ catalog_sales cs1
+ ,date_dim
+ ,customer_address
+ ,call_center
+where
+ d_date between '1999-4-01' and
+ (cast('1999-4-01' as date) + 60 days)
+and cs1.cs_ship_date_sk = d_date_sk
+and cs1.cs_ship_addr_sk = ca_address_sk
+and ca_state = 'IL'
+and cs1.cs_call_center_sk = cc_call_center_sk
+and cc_county in ('Richland County','Bronx County','Maverick County','Mesa County',
+ 'Raleigh County'
+)
+and exists (select *
+ from catalog_sales cs2
+ where cs1.cs_order_number = cs2.cs_order_number
+ and cs1.cs_warehouse_sk <> cs2.cs_warehouse_sk)
+and not exists(select *
+ from catalog_returns cr1
+ where cs1.cs_order_number = cr1.cr_order_number)
+order by count(distinct cs_order_number)
+limit 100;
+
+-- end query 1 in stream 0 using template query16.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query17.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query17.sql
new file mode 100644
index 0000000000..b369def172
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query17.sql
@@ -0,0 +1,45 @@
+-- start query 1 in stream 0 using template query17.tpl and seed 1819994127
+select i_item_id
+ ,i_item_desc
+ ,s_state
+ ,count(ss_quantity) as store_sales_quantitycount
+ ,avg(ss_quantity) as store_sales_quantityave
+ ,stddev_samp(ss_quantity) as store_sales_quantitystdev
+ ,stddev_samp(ss_quantity)/avg(ss_quantity) as store_sales_quantitycov
+ ,count(sr_return_quantity) as store_returns_quantitycount
+ ,avg(sr_return_quantity) as store_returns_quantityave
+ ,stddev_samp(sr_return_quantity) as store_returns_quantitystdev
+ ,stddev_samp(sr_return_quantity)/avg(sr_return_quantity) as store_returns_quantitycov
+ ,count(cs_quantity) as catalog_sales_quantitycount ,avg(cs_quantity) as catalog_sales_quantityave
+ ,stddev_samp(cs_quantity) as catalog_sales_quantitystdev
+ ,stddev_samp(cs_quantity)/avg(cs_quantity) as catalog_sales_quantitycov
+ from store_sales
+ ,store_returns
+ ,catalog_sales
+ ,date_dim d1
+ ,date_dim d2
+ ,date_dim d3
+ ,store
+ ,item
+ where d1.d_quarter_name = '2000Q1'
+ and d1.d_date_sk = ss_sold_date_sk
+ and i_item_sk = ss_item_sk
+ and s_store_sk = ss_store_sk
+ and ss_customer_sk = sr_customer_sk
+ and ss_item_sk = sr_item_sk
+ and ss_ticket_number = sr_ticket_number
+ and sr_returned_date_sk = d2.d_date_sk
+ and d2.d_quarter_name in ('2000Q1','2000Q2','2000Q3')
+ and sr_customer_sk = cs_bill_customer_sk
+ and sr_item_sk = cs_item_sk
+ and cs_sold_date_sk = d3.d_date_sk
+ and d3.d_quarter_name in ('2000Q1','2000Q2','2000Q3')
+ group by i_item_id
+ ,i_item_desc
+ ,s_state
+ order by i_item_id
+ ,i_item_desc
+ ,s_state
+limit 100;
+
+-- end query 1 in stream 0 using template query17.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query18.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query18.sql
new file mode 100644
index 0000000000..ee3b5b643f
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query18.sql
@@ -0,0 +1,34 @@
+-- start query 1 in stream 0 using template query18.tpl and seed 1978355063
+select i_item_id,
+ ca_country,
+ ca_state,
+ ca_county,
+ avg( cast(cs_quantity as decimal(12,2))) agg1,
+ avg( cast(cs_list_price as decimal(12,2))) agg2,
+ avg( cast(cs_coupon_amt as decimal(12,2))) agg3,
+ avg( cast(cs_sales_price as decimal(12,2))) agg4,
+ avg( cast(cs_net_profit as decimal(12,2))) agg5,
+ avg( cast(c_birth_year as decimal(12,2))) agg6,
+ avg( cast(cd1.cd_dep_count as decimal(12,2))) agg7
+ from catalog_sales, customer_demographics cd1,
+ customer_demographics cd2, customer, customer_address, date_dim, item
+ where cs_sold_date_sk = d_date_sk and
+ cs_item_sk = i_item_sk and
+ cs_bill_cdemo_sk = cd1.cd_demo_sk and
+ cs_bill_customer_sk = c_customer_sk and
+ cd1.cd_gender = 'M' and
+ cd1.cd_education_status = 'Unknown' and
+ c_current_cdemo_sk = cd2.cd_demo_sk and
+ c_current_addr_sk = ca_address_sk and
+ c_birth_month in (5,1,4,7,8,9) and
+ d_year = 2002 and
+ ca_state in ('AR','TX','NC'
+ ,'GA','MS','WV','AL')
+ group by rollup (i_item_id, ca_country, ca_state, ca_county)
+ order by ca_country,
+ ca_state,
+ ca_county,
+ i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query18.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query19.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query19.sql
new file mode 100644
index 0000000000..e4c65411bc
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query19.sql
@@ -0,0 +1,25 @@
+-- start query 1 in stream 0 using template query19.tpl and seed 1930872976
+select i_brand_id brand_id, i_brand brand, i_manufact_id, i_manufact,
+ sum(ss_ext_sales_price) ext_price
+ from date_dim, store_sales, item,customer,customer_address,store
+ where d_date_sk = ss_sold_date_sk
+ and ss_item_sk = i_item_sk
+ and i_manager_id=16
+ and d_moy=12
+ and d_year=1998
+ and ss_customer_sk = c_customer_sk
+ and c_current_addr_sk = ca_address_sk
+ and substr(ca_zip,1,5) <> substr(s_zip,1,5)
+ and ss_store_sk = s_store_sk
+ group by i_brand
+ ,i_brand_id
+ ,i_manufact_id
+ ,i_manufact
+ order by ext_price desc
+ ,i_brand
+ ,i_brand_id
+ ,i_manufact_id
+ ,i_manufact
+limit 100 ;
+
+-- end query 1 in stream 0 using template query19.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query2.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query2.sql
new file mode 100644
index 0000000000..cb6f026d29
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query2.sql
@@ -0,0 +1,60 @@
+-- start query 1 in stream 0 using template query2.tpl and seed 1819994127
+with wscs as
+ (select sold_date_sk
+ ,sales_price
+ from (select ws_sold_date_sk sold_date_sk
+ ,ws_ext_sales_price sales_price
+ from web_sales) x
+ union all
+ (select cs_sold_date_sk sold_date_sk
+ ,cs_ext_sales_price sales_price
+ from catalog_sales)),
+ wswscs as
+ (select d_week_seq,
+ sum(case when (d_day_name='Sunday') then sales_price else null end) sun_sales,
+ sum(case when (d_day_name='Monday') then sales_price else null end) mon_sales,
+ sum(case when (d_day_name='Tuesday') then sales_price else null end) tue_sales,
+ sum(case when (d_day_name='Wednesday') then sales_price else null end) wed_sales,
+ sum(case when (d_day_name='Thursday') then sales_price else null end) thu_sales,
+ sum(case when (d_day_name='Friday') then sales_price else null end) fri_sales,
+ sum(case when (d_day_name='Saturday') then sales_price else null end) sat_sales
+ from wscs
+ ,date_dim
+ where d_date_sk = sold_date_sk
+ group by d_week_seq)
+ select d_week_seq1
+ ,round(sun_sales1/sun_sales2,2)
+ ,round(mon_sales1/mon_sales2,2)
+ ,round(tue_sales1/tue_sales2,2)
+ ,round(wed_sales1/wed_sales2,2)
+ ,round(thu_sales1/thu_sales2,2)
+ ,round(fri_sales1/fri_sales2,2)
+ ,round(sat_sales1/sat_sales2,2)
+ from
+ (select wswscs.d_week_seq d_week_seq1
+ ,sun_sales sun_sales1
+ ,mon_sales mon_sales1
+ ,tue_sales tue_sales1
+ ,wed_sales wed_sales1
+ ,thu_sales thu_sales1
+ ,fri_sales fri_sales1
+ ,sat_sales sat_sales1
+ from wswscs,date_dim
+ where date_dim.d_week_seq = wswscs.d_week_seq and
+ d_year = 1998) y,
+ (select wswscs.d_week_seq d_week_seq2
+ ,sun_sales sun_sales2
+ ,mon_sales mon_sales2
+ ,tue_sales tue_sales2
+ ,wed_sales wed_sales2
+ ,thu_sales thu_sales2
+ ,fri_sales fri_sales2
+ ,sat_sales sat_sales2
+ from wswscs
+ ,date_dim
+ where date_dim.d_week_seq = wswscs.d_week_seq and
+ d_year = 1998+1) z
+ where d_week_seq1=d_week_seq2-53
+ order by d_week_seq1;
+
+-- end query 1 in stream 0 using template query2.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query20.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query20.sql
new file mode 100644
index 0000000000..f6e7e46128
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query20.sql
@@ -0,0 +1,30 @@
+-- start query 1 in stream 0 using template query20.tpl and seed 345591136
+select i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+ ,sum(cs_ext_sales_price) as itemrevenue
+ ,sum(cs_ext_sales_price)*100/sum(sum(cs_ext_sales_price)) over
+ (partition by i_class) as revenueratio
+ from catalog_sales
+ ,item
+ ,date_dim
+ where cs_item_sk = i_item_sk
+ and i_category in ('Shoes', 'Electronics', 'Children')
+ and cs_sold_date_sk = d_date_sk
+ and d_date between cast('2001-03-14' as date)
+ and (cast('2001-03-14' as date) + 30 days)
+ group by i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+ order by i_category
+ ,i_class
+ ,i_item_id
+ ,i_item_desc
+ ,revenueratio
+limit 100;
+
+-- end query 1 in stream 0 using template query20.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query21.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query21.sql
new file mode 100644
index 0000000000..372fcd781a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query21.sql
@@ -0,0 +1,30 @@
+-- start query 1 in stream 0 using template query21.tpl and seed 1819994127
+select *
+ from(select w_warehouse_name
+ ,i_item_id
+ ,sum(case when (cast(d_date as date) < cast ('1999-03-20' as date))
+ then inv_quantity_on_hand
+ else 0 end) as inv_before
+ ,sum(case when (cast(d_date as date) >= cast ('1999-03-20' as date))
+ then inv_quantity_on_hand
+ else 0 end) as inv_after
+ from inventory
+ ,warehouse
+ ,item
+ ,date_dim
+ where i_current_price between 0.99 and 1.49
+ and i_item_sk = inv_item_sk
+ and inv_warehouse_sk = w_warehouse_sk
+ and inv_date_sk = d_date_sk
+ and d_date between (cast ('1999-03-20' as date) - 30 days)
+ and (cast ('1999-03-20' as date) + 30 days)
+ group by w_warehouse_name, i_item_id) x
+ where (case when inv_before > 0
+ then inv_after / inv_before
+ else null
+ end) between 2.0/3.0 and 3.0/2.0
+ order by w_warehouse_name
+ ,i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query21.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query22.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query22.sql
new file mode 100644
index 0000000000..07c4869a4f
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query22.sql
@@ -0,0 +1,20 @@
+-- start query 1 in stream 0 using template query22.tpl and seed 1819994127
+select i_product_name
+ ,i_brand
+ ,i_class
+ ,i_category
+ ,avg(inv_quantity_on_hand) qoh
+ from inventory
+ ,date_dim
+ ,item
+ where inv_date_sk=d_date_sk
+ and inv_item_sk=i_item_sk
+ and d_month_seq between 1186 and 1186 + 11
+ group by rollup(i_product_name
+ ,i_brand
+ ,i_class
+ ,i_category)
+order by qoh, i_product_name, i_brand, i_class, i_category
+limit 100;
+
+-- end query 1 in stream 0 using template query22.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query23.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query23.sql
new file mode 100644
index 0000000000..7c2c2d7d51
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query23.sql
@@ -0,0 +1,107 @@
+-- start query 1 in stream 0 using template query23.tpl and seed 2031708268
+with frequent_ss_items as
+ (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
+ from store_sales
+ ,date_dim
+ ,item
+ where ss_sold_date_sk = d_date_sk
+ and ss_item_sk = i_item_sk
+ and d_year in (2000,2000+1,2000+2,2000+3)
+ group by substr(i_item_desc,1,30),i_item_sk,d_date
+ having count(*) >4),
+ max_store_sales as
+ (select max(csales) tpcds_cmax
+ from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales
+ from store_sales
+ ,customer
+ ,date_dim
+ where ss_customer_sk = c_customer_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year in (2000,2000+1,2000+2,2000+3)
+ group by c_customer_sk) x),
+ best_ss_customer as
+ (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales
+ from store_sales
+ ,customer
+ where ss_customer_sk = c_customer_sk
+ group by c_customer_sk
+ having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select
+ *
+from
+ max_store_sales))
+ select sum(sales)
+ from (select cs_quantity*cs_list_price sales
+ from catalog_sales
+ ,date_dim
+ where d_year = 2000
+ and d_moy = 3
+ and cs_sold_date_sk = d_date_sk
+ and cs_item_sk in (select item_sk from frequent_ss_items)
+ and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer)
+ union all
+ select ws_quantity*ws_list_price sales
+ from web_sales
+ ,date_dim
+ where d_year = 2000
+ and d_moy = 3
+ and ws_sold_date_sk = d_date_sk
+ and ws_item_sk in (select item_sk from frequent_ss_items)
+ and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)) y
+ limit 100;
+with frequent_ss_items as
+ (select substr(i_item_desc,1,30) itemdesc,i_item_sk item_sk,d_date solddate,count(*) cnt
+ from store_sales
+ ,date_dim
+ ,item
+ where ss_sold_date_sk = d_date_sk
+ and ss_item_sk = i_item_sk
+ and d_year in (2000,2000 + 1,2000 + 2,2000 + 3)
+ group by substr(i_item_desc,1,30),i_item_sk,d_date
+ having count(*) >4),
+ max_store_sales as
+ (select max(csales) tpcds_cmax
+ from (select c_customer_sk,sum(ss_quantity*ss_sales_price) csales
+ from store_sales
+ ,customer
+ ,date_dim
+ where ss_customer_sk = c_customer_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year in (2000,2000+1,2000+2,2000+3)
+ group by c_customer_sk) x),
+ best_ss_customer as
+ (select c_customer_sk,sum(ss_quantity*ss_sales_price) ssales
+ from store_sales
+ ,customer
+ where ss_customer_sk = c_customer_sk
+ group by c_customer_sk
+ having sum(ss_quantity*ss_sales_price) > (95/100.0) * (select
+ *
+ from max_store_sales))
+ select c_last_name,c_first_name,sales
+ from (select c_last_name,c_first_name,sum(cs_quantity*cs_list_price) sales
+ from catalog_sales
+ ,customer
+ ,date_dim
+ where d_year = 2000
+ and d_moy = 3
+ and cs_sold_date_sk = d_date_sk
+ and cs_item_sk in (select item_sk from frequent_ss_items)
+ and cs_bill_customer_sk in (select c_customer_sk from best_ss_customer)
+ and cs_bill_customer_sk = c_customer_sk
+ group by c_last_name,c_first_name
+ union all
+ select c_last_name,c_first_name,sum(ws_quantity*ws_list_price) sales
+ from web_sales
+ ,customer
+ ,date_dim
+ where d_year = 2000
+ and d_moy = 3
+ and ws_sold_date_sk = d_date_sk
+ and ws_item_sk in (select item_sk from frequent_ss_items)
+ and ws_bill_customer_sk in (select c_customer_sk from best_ss_customer)
+ and ws_bill_customer_sk = c_customer_sk
+ group by c_last_name,c_first_name) y
+ order by c_last_name,c_first_name,sales
+ limit 100;
+
+-- end query 1 in stream 0 using template query23.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query24.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query24.sql
new file mode 100644
index 0000000000..034b9cf170
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query24.sql
@@ -0,0 +1,107 @@
+-- start query 1 in stream 0 using template query24.tpl and seed 1220860970
+with ssales as
+(select c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,ca_state
+ ,s_state
+ ,i_color
+ ,i_current_price
+ ,i_manager_id
+ ,i_units
+ ,i_size
+ ,sum(ss_sales_price) netpaid
+from store_sales
+ ,store_returns
+ ,store
+ ,item
+ ,customer
+ ,customer_address
+where ss_ticket_number = sr_ticket_number
+ and ss_item_sk = sr_item_sk
+ and ss_customer_sk = c_customer_sk
+ and ss_item_sk = i_item_sk
+ and ss_store_sk = s_store_sk
+ and c_current_addr_sk = ca_address_sk
+ and c_birth_country <> upper(ca_country)
+ and s_zip = ca_zip
+and s_market_id=10
+group by c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,ca_state
+ ,s_state
+ ,i_color
+ ,i_current_price
+ ,i_manager_id
+ ,i_units
+ ,i_size)
+select c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,sum(netpaid) paid
+from ssales
+where i_color = 'snow'
+group by c_last_name
+ ,c_first_name
+ ,s_store_name
+having sum(netpaid) > (select 0.05*avg(netpaid)
+ from ssales)
+order by c_last_name
+ ,c_first_name
+ ,s_store_name
+;
+with ssales as
+(select c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,ca_state
+ ,s_state
+ ,i_color
+ ,i_current_price
+ ,i_manager_id
+ ,i_units
+ ,i_size
+ ,sum(ss_sales_price) netpaid
+from store_sales
+ ,store_returns
+ ,store
+ ,item
+ ,customer
+ ,customer_address
+where ss_ticket_number = sr_ticket_number
+ and ss_item_sk = sr_item_sk
+ and ss_customer_sk = c_customer_sk
+ and ss_item_sk = i_item_sk
+ and ss_store_sk = s_store_sk
+ and c_current_addr_sk = ca_address_sk
+ and c_birth_country <> upper(ca_country)
+ and s_zip = ca_zip
+ and s_market_id = 10
+group by c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,ca_state
+ ,s_state
+ ,i_color
+ ,i_current_price
+ ,i_manager_id
+ ,i_units
+ ,i_size)
+select c_last_name
+ ,c_first_name
+ ,s_store_name
+ ,sum(netpaid) paid
+from ssales
+where i_color = 'chiffon'
+group by c_last_name
+ ,c_first_name
+ ,s_store_name
+having sum(netpaid) > (select 0.05*avg(netpaid)
+ from ssales)
+order by c_last_name
+ ,c_first_name
+ ,s_store_name
+;
+
+-- end query 1 in stream 0 using template query24.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query25.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query25.sql
new file mode 100644
index 0000000000..3e2624c021
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query25.sql
@@ -0,0 +1,48 @@
+-- start query 1 in stream 0 using template query25.tpl and seed 1819994127
+select
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ ,sum(ss_net_profit) as store_sales_profit
+ ,sum(sr_net_loss) as store_returns_loss
+ ,sum(cs_net_profit) as catalog_sales_profit
+ from
+ store_sales
+ ,store_returns
+ ,catalog_sales
+ ,date_dim d1
+ ,date_dim d2
+ ,date_dim d3
+ ,store
+ ,item
+ where
+ d1.d_moy = 4
+ and d1.d_year = 2000
+ and d1.d_date_sk = ss_sold_date_sk
+ and i_item_sk = ss_item_sk
+ and s_store_sk = ss_store_sk
+ and ss_customer_sk = sr_customer_sk
+ and ss_item_sk = sr_item_sk
+ and ss_ticket_number = sr_ticket_number
+ and sr_returned_date_sk = d2.d_date_sk
+ and d2.d_moy between 4 and 10
+ and d2.d_year = 2000
+ and sr_customer_sk = cs_bill_customer_sk
+ and sr_item_sk = cs_item_sk
+ and cs_sold_date_sk = d3.d_date_sk
+ and d3.d_moy between 4 and 10
+ and d3.d_year = 2000
+ group by
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ order by
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ limit 100;
+
+-- end query 1 in stream 0 using template query25.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query26.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query26.sql
new file mode 100644
index 0000000000..7298126cf4
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query26.sql
@@ -0,0 +1,21 @@
+-- start query 1 in stream 0 using template query26.tpl and seed 1930872976
+select i_item_id,
+ avg(cs_quantity) agg1,
+ avg(cs_list_price) agg2,
+ avg(cs_coupon_amt) agg3,
+ avg(cs_sales_price) agg4
+ from catalog_sales, customer_demographics, date_dim, item, promotion
+ where cs_sold_date_sk = d_date_sk and
+ cs_item_sk = i_item_sk and
+ cs_bill_cdemo_sk = cd_demo_sk and
+ cs_promo_sk = p_promo_sk and
+ cd_gender = 'F' and
+ cd_marital_status = 'S' and
+ cd_education_status = 'College' and
+ (p_channel_email = 'N' or p_channel_event = 'N') and
+ d_year = 1998
+ group by i_item_id
+ order by i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query26.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query27.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query27.sql
new file mode 100644
index 0000000000..9a906c4a02
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query27.sql
@@ -0,0 +1,23 @@
+-- start query 1 in stream 0 using template query27.tpl and seed 2017787633
+select i_item_id,
+ s_state, grouping(s_state) g_state,
+ avg(ss_quantity) agg1,
+ avg(ss_list_price) agg2,
+ avg(ss_coupon_amt) agg3,
+ avg(ss_sales_price) agg4
+ from store_sales, customer_demographics, date_dim, store, item
+ where ss_sold_date_sk = d_date_sk and
+ ss_item_sk = i_item_sk and
+ ss_store_sk = s_store_sk and
+ ss_cdemo_sk = cd_demo_sk and
+ cd_gender = 'F' and
+ cd_marital_status = 'U' and
+ cd_education_status = '2 yr Degree' and
+ d_year = 2000 and
+ s_state in ('AL','IN', 'SC', 'NY', 'OH', 'FL')
+ group by rollup (i_item_id, s_state)
+ order by i_item_id
+ ,s_state
+ limit 100;
+
+-- end query 1 in stream 0 using template query27.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query28.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query28.sql
new file mode 100644
index 0000000000..17133f91f7
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query28.sql
@@ -0,0 +1,53 @@
+-- start query 1 in stream 0 using template query28.tpl and seed 444293455
+select *
+from (select avg(ss_list_price) B1_LP
+ ,count(ss_list_price) B1_CNT
+ ,count(distinct ss_list_price) B1_CNTD
+ from store_sales
+ where ss_quantity between 0 and 5
+ and (ss_list_price between 73 and 73+10
+ or ss_coupon_amt between 7826 and 7826+1000
+ or ss_wholesale_cost between 70 and 70+20)) B1,
+ (select avg(ss_list_price) B2_LP
+ ,count(ss_list_price) B2_CNT
+ ,count(distinct ss_list_price) B2_CNTD
+ from store_sales
+ where ss_quantity between 6 and 10
+ and (ss_list_price between 152 and 152+10
+ or ss_coupon_amt between 2196 and 2196+1000
+ or ss_wholesale_cost between 56 and 56+20)) B2,
+ (select avg(ss_list_price) B3_LP
+ ,count(ss_list_price) B3_CNT
+ ,count(distinct ss_list_price) B3_CNTD
+ from store_sales
+ where ss_quantity between 11 and 15
+ and (ss_list_price between 53 and 53+10
+ or ss_coupon_amt between 3430 and 3430+1000
+ or ss_wholesale_cost between 13 and 13+20)) B3,
+ (select avg(ss_list_price) B4_LP
+ ,count(ss_list_price) B4_CNT
+ ,count(distinct ss_list_price) B4_CNTD
+ from store_sales
+ where ss_quantity between 16 and 20
+ and (ss_list_price between 182 and 182+10
+ or ss_coupon_amt between 3262 and 3262+1000
+ or ss_wholesale_cost between 20 and 20+20)) B4,
+ (select avg(ss_list_price) B5_LP
+ ,count(ss_list_price) B5_CNT
+ ,count(distinct ss_list_price) B5_CNTD
+ from store_sales
+ where ss_quantity between 21 and 25
+ and (ss_list_price between 85 and 85+10
+ or ss_coupon_amt between 3310 and 3310+1000
+ or ss_wholesale_cost between 37 and 37+20)) B5,
+ (select avg(ss_list_price) B6_LP
+ ,count(ss_list_price) B6_CNT
+ ,count(distinct ss_list_price) B6_CNTD
+ from store_sales
+ where ss_quantity between 26 and 30
+ and (ss_list_price between 180 and 180+10
+ or ss_coupon_amt between 12592 and 12592+1000
+ or ss_wholesale_cost between 22 and 22+20)) B6
+limit 100;
+
+-- end query 1 in stream 0 using template query28.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query29.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query29.sql
new file mode 100644
index 0000000000..4491e5393a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query29.sql
@@ -0,0 +1,47 @@
+-- start query 1 in stream 0 using template query29.tpl and seed 2031708268
+select
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ ,stddev_samp(ss_quantity) as store_sales_quantity
+ ,stddev_samp(sr_return_quantity) as store_returns_quantity
+ ,stddev_samp(cs_quantity) as catalog_sales_quantity
+ from
+ store_sales
+ ,store_returns
+ ,catalog_sales
+ ,date_dim d1
+ ,date_dim d2
+ ,date_dim d3
+ ,store
+ ,item
+ where
+ d1.d_moy = 4
+ and d1.d_year = 1998
+ and d1.d_date_sk = ss_sold_date_sk
+ and i_item_sk = ss_item_sk
+ and s_store_sk = ss_store_sk
+ and ss_customer_sk = sr_customer_sk
+ and ss_item_sk = sr_item_sk
+ and ss_ticket_number = sr_ticket_number
+ and sr_returned_date_sk = d2.d_date_sk
+ and d2.d_moy between 4 and 4 + 3
+ and d2.d_year = 1998
+ and sr_customer_sk = cs_bill_customer_sk
+ and sr_item_sk = cs_item_sk
+ and cs_sold_date_sk = d3.d_date_sk
+ and d3.d_year in (1998,1998+1,1998+2)
+ group by
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ order by
+ i_item_id
+ ,i_item_desc
+ ,s_store_id
+ ,s_store_name
+ limit 100;
+
+-- end query 1 in stream 0 using template query29.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query3.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query3.sql
new file mode 100644
index 0000000000..1944edb876
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query3.sql
@@ -0,0 +1,21 @@
+-- start query 1 in stream 0 using template query3.tpl and seed 2031708268
+select dt.d_year
+ ,item.i_brand_id brand_id
+ ,item.i_brand brand
+ ,sum(ss_sales_price) sum_agg
+ from date_dim dt
+ ,store_sales
+ ,item
+ where dt.d_date_sk = store_sales.ss_sold_date_sk
+ and store_sales.ss_item_sk = item.i_item_sk
+ and item.i_manufact_id = 816
+ and dt.d_moy=11
+ group by dt.d_year
+ ,item.i_brand
+ ,item.i_brand_id
+ order by dt.d_year
+ ,sum_agg desc
+ ,brand_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query3.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query30.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query30.sql
new file mode 100644
index 0000000000..a1702d12f6
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query30.sql
@@ -0,0 +1,31 @@
+-- start query 1 in stream 0 using template query30.tpl and seed 1819994127
+with customer_total_return as
+ (select wr_returning_customer_sk as ctr_customer_sk
+ ,ca_state as ctr_state,
+ sum(wr_return_amt) as ctr_total_return
+ from web_returns
+ ,date_dim
+ ,customer_address
+ where wr_returned_date_sk = d_date_sk
+ and d_year =2000
+ and wr_returning_addr_sk = ca_address_sk
+ group by wr_returning_customer_sk
+ ,ca_state)
+ select c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+ ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+ ,c_last_review_date_sk,ctr_total_return
+ from customer_total_return ctr1
+ ,customer_address
+ ,customer
+ where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
+ from customer_total_return ctr2
+ where ctr1.ctr_state = ctr2.ctr_state)
+ and ca_address_sk = c_current_addr_sk
+ and ca_state = 'GA'
+ and ctr1.ctr_customer_sk = c_customer_sk
+ order by c_customer_id,c_salutation,c_first_name,c_last_name,c_preferred_cust_flag
+ ,c_birth_day,c_birth_month,c_birth_year,c_birth_country,c_login,c_email_address
+ ,c_last_review_date_sk,ctr_total_return
+limit 100;
+
+-- end query 1 in stream 0 using template query30.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query31.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query31.sql
new file mode 100644
index 0000000000..1c89b65513
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query31.sql
@@ -0,0 +1,52 @@
+-- start query 1 in stream 0 using template query31.tpl and seed 1819994127
+with ss as
+ (select ca_county,d_qoy, d_year,sum(ss_ext_sales_price) as store_sales
+ from store_sales,date_dim,customer_address
+ where ss_sold_date_sk = d_date_sk
+ and ss_addr_sk=ca_address_sk
+ group by ca_county,d_qoy, d_year),
+ ws as
+ (select ca_county,d_qoy, d_year,sum(ws_ext_sales_price) as web_sales
+ from web_sales,date_dim,customer_address
+ where ws_sold_date_sk = d_date_sk
+ and ws_bill_addr_sk=ca_address_sk
+ group by ca_county,d_qoy, d_year)
+ select
+ ss1.ca_county
+ ,ss1.d_year
+ ,ws2.web_sales/ws1.web_sales web_q1_q2_increase
+ ,ss2.store_sales/ss1.store_sales store_q1_q2_increase
+ ,ws3.web_sales/ws2.web_sales web_q2_q3_increase
+ ,ss3.store_sales/ss2.store_sales store_q2_q3_increase
+ from
+ ss ss1
+ ,ss ss2
+ ,ss ss3
+ ,ws ws1
+ ,ws ws2
+ ,ws ws3
+ where
+ ss1.d_qoy = 1
+ and ss1.d_year = 1999
+ and ss1.ca_county = ss2.ca_county
+ and ss2.d_qoy = 2
+ and ss2.d_year = 1999
+ and ss2.ca_county = ss3.ca_county
+ and ss3.d_qoy = 3
+ and ss3.d_year = 1999
+ and ss1.ca_county = ws1.ca_county
+ and ws1.d_qoy = 1
+ and ws1.d_year = 1999
+ and ws1.ca_county = ws2.ca_county
+ and ws2.d_qoy = 2
+ and ws2.d_year = 1999
+ and ws1.ca_county = ws3.ca_county
+ and ws3.d_qoy = 3
+ and ws3.d_year =1999
+ and case when ws1.web_sales > 0 then ws2.web_sales/ws1.web_sales else null end
+ > case when ss1.store_sales > 0 then ss2.store_sales/ss1.store_sales else null end
+ and case when ws2.web_sales > 0 then ws3.web_sales/ws2.web_sales else null end
+ > case when ss2.store_sales > 0 then ss3.store_sales/ss2.store_sales else null end
+ order by ss1.d_year;
+
+-- end query 1 in stream 0 using template query31.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query32.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query32.sql
new file mode 100644
index 0000000000..f1f8098ca3
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query32.sql
@@ -0,0 +1,28 @@
+-- start query 1 in stream 0 using template query32.tpl and seed 2031708268
+select sum(cs_ext_discount_amt) as `excess discount amount`
+from
+ catalog_sales
+ ,item
+ ,date_dim
+where
+i_manufact_id = 66
+and i_item_sk = cs_item_sk
+and d_date between '2002-03-29' and
+ (cast('2002-03-29' as date) + 90 days)
+and d_date_sk = cs_sold_date_sk
+and cs_ext_discount_amt
+ > (
+ select
+ 1.3 * avg(cs_ext_discount_amt)
+ from
+ catalog_sales
+ ,date_dim
+ where
+ cs_item_sk = i_item_sk
+ and d_date between '2002-03-29' and
+ (cast('2002-03-29' as date) + 90 days)
+ and d_date_sk = cs_sold_date_sk
+ )
+limit 100;
+
+-- end query 1 in stream 0 using template query32.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query33.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query33.sql
new file mode 100644
index 0000000000..d075de4683
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query33.sql
@@ -0,0 +1,75 @@
+-- start query 1 in stream 0 using template query33.tpl and seed 1930872976
+with ss as (
+ select
+ i_manufact_id,sum(ss_ext_sales_price) total_sales
+ from
+ store_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_manufact_id in (select
+ i_manufact_id
+from
+ item
+where i_category in ('Home'))
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 5
+ and ss_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_manufact_id),
+ cs as (
+ select
+ i_manufact_id,sum(cs_ext_sales_price) total_sales
+ from
+ catalog_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_manufact_id in (select
+ i_manufact_id
+from
+ item
+where i_category in ('Home'))
+ and cs_item_sk = i_item_sk
+ and cs_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 5
+ and cs_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_manufact_id),
+ ws as (
+ select
+ i_manufact_id,sum(ws_ext_sales_price) total_sales
+ from
+ web_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_manufact_id in (select
+ i_manufact_id
+from
+ item
+where i_category in ('Home'))
+ and ws_item_sk = i_item_sk
+ and ws_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 5
+ and ws_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_manufact_id)
+ select i_manufact_id ,sum(total_sales) total_sales
+ from (select * from ss
+ union all
+ select * from cs
+ union all
+ select * from ws) tmp1
+ group by i_manufact_id
+ order by total_sales
+limit 100;
+
+-- end query 1 in stream 0 using template query33.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query34.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query34.sql
new file mode 100644
index 0000000000..e5ddc4c1d4
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query34.sql
@@ -0,0 +1,31 @@
+-- start query 1 in stream 0 using template query34.tpl and seed 1971067816
+select c_last_name
+ ,c_first_name
+ ,c_salutation
+ ,c_preferred_cust_flag
+ ,ss_ticket_number
+ ,cnt from
+ (select ss_ticket_number
+ ,ss_customer_sk
+ ,count(*) cnt
+ from store_sales,date_dim,store,household_demographics
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_store_sk = store.s_store_sk
+ and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+ and (date_dim.d_dom between 1 and 3 or date_dim.d_dom between 25 and 28)
+ and (household_demographics.hd_buy_potential = '>10000' or
+ household_demographics.hd_buy_potential = 'Unknown')
+ and household_demographics.hd_vehicle_count > 0
+ and (case when household_demographics.hd_vehicle_count > 0
+ then household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count
+ else null
+ end) > 1.2
+ and date_dim.d_year in (2000,2000+1,2000+2)
+ and store.s_county in ('Salem County','Terrell County','Arthur County','Oglethorpe County',
+ 'Lunenburg County','Perry County','Halifax County','Sumner County')
+ group by ss_ticket_number,ss_customer_sk) dn,customer
+ where ss_customer_sk = c_customer_sk
+ and cnt between 15 and 20
+ order by c_last_name,c_first_name,c_salutation,c_preferred_cust_flag desc, ss_ticket_number;
+
+-- end query 1 in stream 0 using template query34.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query35.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query35.sql
new file mode 100644
index 0000000000..ef7cdf0bbd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query35.sql
@@ -0,0 +1,58 @@
+-- start query 1 in stream 0 using template query35.tpl and seed 1930872976
+select
+ ca_state,
+ cd_gender,
+ cd_marital_status,
+ cd_dep_count,
+ count(*) cnt1,
+ avg(cd_dep_count),
+ min(cd_dep_count),
+ stddev_samp(cd_dep_count),
+ cd_dep_employed_count,
+ count(*) cnt2,
+ avg(cd_dep_employed_count),
+ min(cd_dep_employed_count),
+ stddev_samp(cd_dep_employed_count),
+ cd_dep_college_count,
+ count(*) cnt3,
+ avg(cd_dep_college_count),
+ min(cd_dep_college_count),
+ stddev_samp(cd_dep_college_count)
+ from
+ customer c,customer_address ca,customer_demographics
+ where
+ c.c_current_addr_sk = ca.ca_address_sk and
+ cd_demo_sk = c.c_current_cdemo_sk and
+ exists (select *
+ from store_sales,date_dim
+ where c.c_customer_sk = ss_customer_sk and
+ ss_sold_date_sk = d_date_sk and
+ d_year = 2001 and
+ d_qoy < 4) and
+ (exists (select *
+ from web_sales,date_dim
+ where c.c_customer_sk = ws_bill_customer_sk and
+ ws_sold_date_sk = d_date_sk and
+ d_year = 2001 and
+ d_qoy < 4) or
+ exists (select *
+ from catalog_sales,date_dim
+ where c.c_customer_sk = cs_ship_customer_sk and
+ cs_sold_date_sk = d_date_sk and
+ d_year = 2001 and
+ d_qoy < 4))
+ group by ca_state,
+ cd_gender,
+ cd_marital_status,
+ cd_dep_count,
+ cd_dep_employed_count,
+ cd_dep_college_count
+ order by ca_state,
+ cd_gender,
+ cd_marital_status,
+ cd_dep_count,
+ cd_dep_employed_count,
+ cd_dep_college_count
+ limit 100;
+
+-- end query 1 in stream 0 using template query35.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query36.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query36.sql
new file mode 100644
index 0000000000..8456fc8c40
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query36.sql
@@ -0,0 +1,30 @@
+-- start query 1 in stream 0 using template query36.tpl and seed 1544728811
+select
+ sum(ss_net_profit)/sum(ss_ext_sales_price) as gross_margin
+ ,i_category
+ ,i_class
+ ,grouping(i_category)+grouping(i_class) as lochierarchy
+ ,rank() over (
+ partition by grouping(i_category)+grouping(i_class),
+ case when grouping(i_class) = 0 then i_category end
+ order by sum(ss_net_profit)/sum(ss_ext_sales_price) asc) as rank_within_parent
+ from
+ store_sales
+ ,date_dim d1
+ ,item
+ ,store
+ where
+ d1.d_year = 1999
+ and d1.d_date_sk = ss_sold_date_sk
+ and i_item_sk = ss_item_sk
+ and s_store_sk = ss_store_sk
+ and s_state in ('IN','AL','MI','MN',
+ 'TN','LA','FL','NM')
+ group by rollup(i_category,i_class)
+ order by
+ lochierarchy desc
+ ,case when lochierarchy = 0 then i_category end
+ ,rank_within_parent
+ limit 100;
+
+-- end query 1 in stream 0 using template query36.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query37.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query37.sql
new file mode 100644
index 0000000000..78960dba87
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query37.sql
@@ -0,0 +1,17 @@
+-- start query 1 in stream 0 using template query37.tpl and seed 301843662
+select i_item_id
+ ,i_item_desc
+ ,i_current_price
+ from item, inventory, date_dim, catalog_sales
+ where i_current_price between 39 and 39 + 30
+ and inv_item_sk = i_item_sk
+ and d_date_sk=inv_date_sk
+ and d_date between cast('2001-01-16' as date) and (cast('2001-01-16' as date) + 60 days)
+ and i_manufact_id in (765,886,889,728)
+ and inv_quantity_on_hand between 100 and 500
+ and cs_item_sk = i_item_sk
+ group by i_item_id,i_item_desc,i_current_price
+ order by i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query37.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query38.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query38.sql
new file mode 100644
index 0000000000..5570ae2029
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query38.sql
@@ -0,0 +1,23 @@
+-- start query 1 in stream 0 using template query38.tpl and seed 1819994127
+select count(*) from (
+ select distinct c_last_name, c_first_name, d_date
+ from store_sales, date_dim, customer
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1186 and 1186 + 11
+ intersect
+ select distinct c_last_name, c_first_name, d_date
+ from catalog_sales, date_dim, customer
+ where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk
+ and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1186 and 1186 + 11
+ intersect
+ select distinct c_last_name, c_first_name, d_date
+ from web_sales, date_dim, customer
+ where web_sales.ws_sold_date_sk = date_dim.d_date_sk
+ and web_sales.ws_bill_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1186 and 1186 + 11
+) hot_cust
+limit 100;
+
+-- end query 1 in stream 0 using template query38.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query39.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query39.sql
new file mode 100644
index 0000000000..9c714fca0e
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query39.sql
@@ -0,0 +1,54 @@
+-- start query 1 in stream 0 using template query39.tpl and seed 1327317894
+with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+ ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+ ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+ from inventory
+ ,item
+ ,warehouse
+ ,date_dim
+ where inv_item_sk = i_item_sk
+ and inv_warehouse_sk = w_warehouse_sk
+ and inv_date_sk = d_date_sk
+ and d_year =2000
+ group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+ ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+ and inv1.w_warehouse_sk = inv2.w_warehouse_sk
+ and inv1.d_moy=2
+ and inv2.d_moy=2+1
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+ ,inv2.d_moy,inv2.mean, inv2.cov
+;
+with inv as
+(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+ ,stdev,mean, case mean when 0 then null else stdev/mean end cov
+ from(select w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy
+ ,stddev_samp(inv_quantity_on_hand) stdev,avg(inv_quantity_on_hand) mean
+ from inventory
+ ,item
+ ,warehouse
+ ,date_dim
+ where inv_item_sk = i_item_sk
+ and inv_warehouse_sk = w_warehouse_sk
+ and inv_date_sk = d_date_sk
+ and d_year =2000
+ group by w_warehouse_name,w_warehouse_sk,i_item_sk,d_moy) foo
+ where case mean when 0 then 0 else stdev/mean end > 1)
+select inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean, inv1.cov
+ ,inv2.w_warehouse_sk,inv2.i_item_sk,inv2.d_moy,inv2.mean, inv2.cov
+from inv inv1,inv inv2
+where inv1.i_item_sk = inv2.i_item_sk
+ and inv1.w_warehouse_sk = inv2.w_warehouse_sk
+ and inv1.d_moy=2
+ and inv2.d_moy=2+1
+ and inv1.cov > 1.5
+order by inv1.w_warehouse_sk,inv1.i_item_sk,inv1.d_moy,inv1.mean,inv1.cov
+ ,inv2.d_moy,inv2.mean, inv2.cov
+;
+
+-- end query 1 in stream 0 using template query39.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query4.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query4.sql
new file mode 100644
index 0000000000..b4fd65bea4
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query4.sql
@@ -0,0 +1,116 @@
+-- start query 1 in stream 0 using template query4.tpl and seed 1819994127
+with year_total as (
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,c_preferred_cust_flag customer_preferred_cust_flag
+ ,c_birth_country customer_birth_country
+ ,c_login customer_login
+ ,c_email_address customer_email_address
+ ,d_year dyear
+ ,sum(((ss_ext_list_price-ss_ext_wholesale_cost-ss_ext_discount_amt)+ss_ext_sales_price)/2) year_total
+ ,'s' sale_type
+ from customer
+ ,store_sales
+ ,date_dim
+ where c_customer_sk = ss_customer_sk
+ and ss_sold_date_sk = d_date_sk
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,c_preferred_cust_flag
+ ,c_birth_country
+ ,c_login
+ ,c_email_address
+ ,d_year
+ union all
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,c_preferred_cust_flag customer_preferred_cust_flag
+ ,c_birth_country customer_birth_country
+ ,c_login customer_login
+ ,c_email_address customer_email_address
+ ,d_year dyear
+ ,sum((((cs_ext_list_price-cs_ext_wholesale_cost-cs_ext_discount_amt)+cs_ext_sales_price)/2) ) year_total
+ ,'c' sale_type
+ from customer
+ ,catalog_sales
+ ,date_dim
+ where c_customer_sk = cs_bill_customer_sk
+ and cs_sold_date_sk = d_date_sk
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,c_preferred_cust_flag
+ ,c_birth_country
+ ,c_login
+ ,c_email_address
+ ,d_year
+union all
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,c_preferred_cust_flag customer_preferred_cust_flag
+ ,c_birth_country customer_birth_country
+ ,c_login customer_login
+ ,c_email_address customer_email_address
+ ,d_year dyear
+ ,sum((((ws_ext_list_price-ws_ext_wholesale_cost-ws_ext_discount_amt)+ws_ext_sales_price)/2) ) year_total
+ ,'w' sale_type
+ from customer
+ ,web_sales
+ ,date_dim
+ where c_customer_sk = ws_bill_customer_sk
+ and ws_sold_date_sk = d_date_sk
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,c_preferred_cust_flag
+ ,c_birth_country
+ ,c_login
+ ,c_email_address
+ ,d_year
+ )
+ select
+ t_s_secyear.customer_id
+ ,t_s_secyear.customer_first_name
+ ,t_s_secyear.customer_last_name
+ ,t_s_secyear.customer_birth_country
+ from year_total t_s_firstyear
+ ,year_total t_s_secyear
+ ,year_total t_c_firstyear
+ ,year_total t_c_secyear
+ ,year_total t_w_firstyear
+ ,year_total t_w_secyear
+ where t_s_secyear.customer_id = t_s_firstyear.customer_id
+ and t_s_firstyear.customer_id = t_c_secyear.customer_id
+ and t_s_firstyear.customer_id = t_c_firstyear.customer_id
+ and t_s_firstyear.customer_id = t_w_firstyear.customer_id
+ and t_s_firstyear.customer_id = t_w_secyear.customer_id
+ and t_s_firstyear.sale_type = 's'
+ and t_c_firstyear.sale_type = 'c'
+ and t_w_firstyear.sale_type = 'w'
+ and t_s_secyear.sale_type = 's'
+ and t_c_secyear.sale_type = 'c'
+ and t_w_secyear.sale_type = 'w'
+ and t_s_firstyear.dyear = 1999
+ and t_s_secyear.dyear = 1999+1
+ and t_c_firstyear.dyear = 1999
+ and t_c_secyear.dyear = 1999+1
+ and t_w_firstyear.dyear = 1999
+ and t_w_secyear.dyear = 1999+1
+ and t_s_firstyear.year_total > 0
+ and t_c_firstyear.year_total > 0
+ and t_w_firstyear.year_total > 0
+ and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end
+ > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end
+ and case when t_c_firstyear.year_total > 0 then t_c_secyear.year_total / t_c_firstyear.year_total else null end
+ > case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end
+ order by t_s_secyear.customer_id
+ ,t_s_secyear.customer_first_name
+ ,t_s_secyear.customer_last_name
+ ,t_s_secyear.customer_birth_country
+limit 100;
+
+-- end query 1 in stream 0 using template query4.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query40.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query40.sql
new file mode 100644
index 0000000000..333dc7fd38
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query40.sql
@@ -0,0 +1,28 @@
+-- start query 1 in stream 0 using template query40.tpl and seed 1819994127
+select
+ w_state
+ ,i_item_id
+ ,sum(case when (cast(d_date as date) < cast ('2000-03-18' as date))
+ then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_before
+ ,sum(case when (cast(d_date as date) >= cast ('2000-03-18' as date))
+ then cs_sales_price - coalesce(cr_refunded_cash,0) else 0 end) as sales_after
+ from
+ catalog_sales left outer join catalog_returns on
+ (cs_order_number = cr_order_number
+ and cs_item_sk = cr_item_sk)
+ ,warehouse
+ ,item
+ ,date_dim
+ where
+ i_current_price between 0.99 and 1.49
+ and i_item_sk = cs_item_sk
+ and cs_warehouse_sk = w_warehouse_sk
+ and cs_sold_date_sk = d_date_sk
+ and d_date between (cast ('2000-03-18' as date) - 30 days)
+ and (cast ('2000-03-18' as date) + 30 days)
+ group by
+ w_state,i_item_id
+ order by w_state,i_item_id
+limit 100;
+
+-- end query 1 in stream 0 using template query40.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query41.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query41.sql
new file mode 100644
index 0000000000..6eb01d5821
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query41.sql
@@ -0,0 +1,52 @@
+-- start query 1 in stream 0 using template query41.tpl and seed 1581015815
+select distinct(i_product_name)
+ from item i1
+ where i_manufact_id between 970 and 970+40
+ and (select count(*) as item_cnt
+ from item
+ where (i_manufact = i1.i_manufact and
+ ((i_category = 'Women' and
+ (i_color = 'frosted' or i_color = 'rose') and
+ (i_units = 'Lb' or i_units = 'Gross') and
+ (i_size = 'medium' or i_size = 'large')
+ ) or
+ (i_category = 'Women' and
+ (i_color = 'chocolate' or i_color = 'black') and
+ (i_units = 'Box' or i_units = 'Dram') and
+ (i_size = 'economy' or i_size = 'petite')
+ ) or
+ (i_category = 'Men' and
+ (i_color = 'slate' or i_color = 'magenta') and
+ (i_units = 'Carton' or i_units = 'Bundle') and
+ (i_size = 'N/A' or i_size = 'small')
+ ) or
+ (i_category = 'Men' and
+ (i_color = 'cornflower' or i_color = 'firebrick') and
+ (i_units = 'Pound' or i_units = 'Oz') and
+ (i_size = 'medium' or i_size = 'large')
+ ))) or
+ (i_manufact = i1.i_manufact and
+ ((i_category = 'Women' and
+ (i_color = 'almond' or i_color = 'steel') and
+ (i_units = 'Tsp' or i_units = 'Case') and
+ (i_size = 'medium' or i_size = 'large')
+ ) or
+ (i_category = 'Women' and
+ (i_color = 'purple' or i_color = 'aquamarine') and
+ (i_units = 'Bunch' or i_units = 'Gram') and
+ (i_size = 'economy' or i_size = 'petite')
+ ) or
+ (i_category = 'Men' and
+ (i_color = 'lavender' or i_color = 'papaya') and
+ (i_units = 'Pallet' or i_units = 'Cup') and
+ (i_size = 'N/A' or i_size = 'small')
+ ) or
+ (i_category = 'Men' and
+ (i_color = 'maroon' or i_color = 'cyan') and
+ (i_units = 'Each' or i_units = 'N/A') and
+ (i_size = 'medium' or i_size = 'large')
+ )))) > 0
+ order by i_product_name
+ limit 100;
+
+-- end query 1 in stream 0 using template query41.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query42.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query42.sql
new file mode 100644
index 0000000000..bbc053206c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query42.sql
@@ -0,0 +1,22 @@
+-- start query 1 in stream 0 using template query42.tpl and seed 1819994127
+select dt.d_year
+ ,item.i_category_id
+ ,item.i_category
+ ,sum(ss_ext_sales_price)
+ from date_dim dt
+ ,store_sales
+ ,item
+ where dt.d_date_sk = store_sales.ss_sold_date_sk
+ and store_sales.ss_item_sk = item.i_item_sk
+ and item.i_manager_id = 1
+ and dt.d_moy=12
+ and dt.d_year=1998
+ group by dt.d_year
+ ,item.i_category_id
+ ,item.i_category
+ order by sum(ss_ext_sales_price) desc,dt.d_year
+ ,item.i_category_id
+ ,item.i_category
+limit 100 ;
+
+-- end query 1 in stream 0 using template query42.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query43.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query43.sql
new file mode 100644
index 0000000000..89843d1e77
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query43.sql
@@ -0,0 +1,19 @@
+-- start query 1 in stream 0 using template query43.tpl and seed 1819994127
+select s_store_name, s_store_id,
+ sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+ sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+ sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales,
+ sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+ sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+ sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+ sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from date_dim, store_sales, store
+ where d_date_sk = ss_sold_date_sk and
+ s_store_sk = ss_store_sk and
+ s_gmt_offset = -6 and
+ d_year = 2001
+ group by s_store_name, s_store_id
+ order by s_store_name, s_store_id,sun_sales,mon_sales,tue_sales,wed_sales,thu_sales,fri_sales,sat_sales
+ limit 100;
+
+-- end query 1 in stream 0 using template query43.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query44.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query44.sql
new file mode 100644
index 0000000000..92d5e0259b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query44.sql
@@ -0,0 +1,35 @@
+-- start query 1 in stream 0 using template query44.tpl and seed 1819994127
+select asceding.rnk, i1.i_product_name best_performing, i2.i_product_name worst_performing
+from(select *
+ from (select item_sk,rank() over (order by rank_col asc) rnk
+ from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col
+ from store_sales ss1
+ where ss_store_sk = 366
+ group by ss_item_sk
+ having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+ from store_sales
+ where ss_store_sk = 366
+ and ss_cdemo_sk is null
+ group by ss_store_sk))V1)V11
+ where rnk < 11) asceding,
+ (select *
+ from (select item_sk,rank() over (order by rank_col desc) rnk
+ from (select ss_item_sk item_sk,avg(ss_net_profit) rank_col
+ from store_sales ss1
+ where ss_store_sk = 366
+ group by ss_item_sk
+ having avg(ss_net_profit) > 0.9*(select avg(ss_net_profit) rank_col
+ from store_sales
+ where ss_store_sk = 366
+ and ss_cdemo_sk is null
+ group by ss_store_sk))V2)V21
+ where rnk < 11) descending,
+item i1,
+item i2
+where asceding.rnk = descending.rnk
+ and i1.i_item_sk=asceding.item_sk
+ and i2.i_item_sk=descending.item_sk
+order by asceding.rnk
+limit 100;
+
+-- end query 1 in stream 0 using template query44.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query45.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query45.sql
new file mode 100644
index 0000000000..16d50682af
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query45.sql
@@ -0,0 +1,20 @@
+-- start query 1 in stream 0 using template query45.tpl and seed 2031708268
+select ca_zip, ca_county, sum(ws_sales_price)
+ from web_sales, customer, customer_address, date_dim, item
+ where ws_bill_customer_sk = c_customer_sk
+ and c_current_addr_sk = ca_address_sk
+ and ws_item_sk = i_item_sk
+ and ( substr(ca_zip,1,5) in ('85669', '86197','88274','83405','86475', '85392', '85460', '80348', '81792')
+ or
+ i_item_id in (select i_item_id
+ from item
+ where i_item_sk in (2, 3, 5, 7, 11, 13, 17, 19, 23, 29)
+ )
+ )
+ and ws_sold_date_sk = d_date_sk
+ and d_qoy = 1 and d_year = 1998
+ group by ca_zip, ca_county
+ order by ca_zip, ca_county
+ limit 100;
+
+-- end query 1 in stream 0 using template query45.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query46.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query46.sql
new file mode 100644
index 0000000000..1adf55dd9b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query46.sql
@@ -0,0 +1,35 @@
+-- start query 1 in stream 0 using template query46.tpl and seed 803547492
+select c_last_name
+ ,c_first_name
+ ,ca_city
+ ,bought_city
+ ,ss_ticket_number
+ ,amt,profit
+ from
+ (select ss_ticket_number
+ ,ss_customer_sk
+ ,ca_city bought_city
+ ,sum(ss_coupon_amt) amt
+ ,sum(ss_net_profit) profit
+ from store_sales,date_dim,store,household_demographics,customer_address
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_store_sk = store.s_store_sk
+ and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+ and store_sales.ss_addr_sk = customer_address.ca_address_sk
+ and (household_demographics.hd_dep_count = 0 or
+ household_demographics.hd_vehicle_count= 1)
+ and date_dim.d_dow in (6,0)
+ and date_dim.d_year in (2000,2000+1,2000+2)
+ and store.s_city in ('Five Forks','Oakland','Fairview','Winchester','Farmington')
+ group by ss_ticket_number,ss_customer_sk,ss_addr_sk,ca_city) dn,customer,customer_address current_addr
+ where ss_customer_sk = c_customer_sk
+ and customer.c_current_addr_sk = current_addr.ca_address_sk
+ and current_addr.ca_city <> bought_city
+ order by c_last_name
+ ,c_first_name
+ ,ca_city
+ ,bought_city
+ ,ss_ticket_number
+ limit 100;
+
+-- end query 1 in stream 0 using template query46.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query47.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query47.sql
new file mode 100644
index 0000000000..8a1437acfb
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query47.sql
@@ -0,0 +1,51 @@
+-- start query 1 in stream 0 using template query47.tpl and seed 2031708268
+with v1 as(
+ select i_category, i_brand,
+ s_store_name, s_company_name,
+ d_year, d_moy,
+ sum(ss_sales_price) sum_sales,
+ avg(sum(ss_sales_price)) over
+ (partition by i_category, i_brand,
+ s_store_name, s_company_name, d_year)
+ avg_monthly_sales,
+ rank() over
+ (partition by i_category, i_brand,
+ s_store_name, s_company_name
+ order by d_year, d_moy) rn
+ from item, store_sales, date_dim, store
+ where ss_item_sk = i_item_sk and
+ ss_sold_date_sk = d_date_sk and
+ ss_store_sk = s_store_sk and
+ (
+ d_year = 1999 or
+ ( d_year = 1999-1 and d_moy =12) or
+ ( d_year = 1999+1 and d_moy =1)
+ )
+ group by i_category, i_brand,
+ s_store_name, s_company_name,
+ d_year, d_moy),
+ v2 as(
+ select v1.s_store_name
+ ,v1.d_year, v1.d_moy
+ ,v1.avg_monthly_sales
+ ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum
+ from v1, v1 v1_lag, v1 v1_lead
+ where v1.i_category = v1_lag.i_category and
+ v1.i_category = v1_lead.i_category and
+ v1.i_brand = v1_lag.i_brand and
+ v1.i_brand = v1_lead.i_brand and
+ v1.s_store_name = v1_lag.s_store_name and
+ v1.s_store_name = v1_lead.s_store_name and
+ v1.s_company_name = v1_lag.s_company_name and
+ v1.s_company_name = v1_lead.s_company_name and
+ v1.rn = v1_lag.rn + 1 and
+ v1.rn = v1_lead.rn - 1)
+ select *
+ from v2
+ where d_year = 1999 and
+ avg_monthly_sales > 0 and
+ case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1
+ order by sum_sales - avg_monthly_sales, sum_sales
+ limit 100;
+
+-- end query 1 in stream 0 using template query47.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query48.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query48.sql
new file mode 100644
index 0000000000..da87862a33
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query48.sql
@@ -0,0 +1,67 @@
+-- start query 1 in stream 0 using template query48.tpl and seed 622697896
+select sum (ss_quantity)
+ from store_sales, store, customer_demographics, customer_address, date_dim
+ where s_store_sk = ss_store_sk
+ and ss_sold_date_sk = d_date_sk and d_year = 1998
+ and
+ (
+ (
+ cd_demo_sk = ss_cdemo_sk
+ and
+ cd_marital_status = 'M'
+ and
+ cd_education_status = 'Unknown'
+ and
+ ss_sales_price between 100.00 and 150.00
+ )
+ or
+ (
+ cd_demo_sk = ss_cdemo_sk
+ and
+ cd_marital_status = 'W'
+ and
+ cd_education_status = 'College'
+ and
+ ss_sales_price between 50.00 and 100.00
+ )
+ or
+ (
+ cd_demo_sk = ss_cdemo_sk
+ and
+ cd_marital_status = 'D'
+ and
+ cd_education_status = 'Primary'
+ and
+ ss_sales_price between 150.00 and 200.00
+ )
+ )
+ and
+ (
+ (
+ ss_addr_sk = ca_address_sk
+ and
+ ca_country = 'United States'
+ and
+ ca_state in ('MI', 'GA', 'NH')
+ and ss_net_profit between 0 and 2000
+ )
+ or
+ (ss_addr_sk = ca_address_sk
+ and
+ ca_country = 'United States'
+ and
+ ca_state in ('TX', 'KY', 'SD')
+ and ss_net_profit between 150 and 3000
+ )
+ or
+ (ss_addr_sk = ca_address_sk
+ and
+ ca_country = 'United States'
+ and
+ ca_state in ('NY', 'OH', 'FL')
+ and ss_net_profit between 50 and 25000
+ )
+ )
+;
+
+-- end query 1 in stream 0 using template query48.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query49.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query49.sql
new file mode 100644
index 0000000000..ac029bd511
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query49.sql
@@ -0,0 +1,129 @@
+-- start query 1 in stream 0 using template query49.tpl and seed 1819994127
+select channel, item, return_ratio, return_rank, currency_rank from
+ (select
+ 'web' as channel
+ ,web.item as item
+ ,web.return_ratio as return_ratio
+ ,web.return_rank as return_rank
+ ,web.currency_rank as currency_rank
+ from (
+ select
+ item
+ ,return_ratio
+ ,currency_ratio
+ ,rank() over (order by return_ratio) as return_rank
+ ,rank() over (order by currency_ratio) as currency_rank
+ from
+ ( select ws.ws_item_sk as item
+ ,(cast(sum(coalesce(wr.wr_return_quantity,0)) as decimal(15,4))/
+ cast(sum(coalesce(ws.ws_quantity,0)) as decimal(15,4) )) as return_ratio
+ ,(cast(sum(coalesce(wr.wr_return_amt,0)) as decimal(15,4))/
+ cast(sum(coalesce(ws.ws_net_paid,0)) as decimal(15,4) )) as currency_ratio
+ from
+ web_sales ws left outer join web_returns wr
+ on (ws.ws_order_number = wr.wr_order_number and
+ ws.ws_item_sk = wr.wr_item_sk)
+ ,date_dim
+ where
+ wr.wr_return_amt > 10000
+ and ws.ws_net_profit > 1
+ and ws.ws_net_paid > 0
+ and ws.ws_quantity > 0
+ and ws_sold_date_sk = d_date_sk
+ and d_year = 2000
+ and d_moy = 12
+ group by ws.ws_item_sk
+ ) in_web
+ ) web
+ where
+ (
+ web.return_rank <= 10
+ or
+ web.currency_rank <= 10
+ )
+ union
+ select
+ 'catalog' as channel
+ ,catalog.item as item
+ ,catalog.return_ratio as return_ratio
+ ,catalog.return_rank as return_rank
+ ,catalog.currency_rank as currency_rank
+ from (
+ select
+ item
+ ,return_ratio
+ ,currency_ratio
+ ,rank() over (order by return_ratio) as return_rank
+ ,rank() over (order by currency_ratio) as currency_rank
+ from
+ ( select
+ cs.cs_item_sk as item
+ ,(cast(sum(coalesce(cr.cr_return_quantity,0)) as decimal(15,4))/
+ cast(sum(coalesce(cs.cs_quantity,0)) as decimal(15,4) )) as return_ratio
+ ,(cast(sum(coalesce(cr.cr_return_amount,0)) as decimal(15,4))/
+ cast(sum(coalesce(cs.cs_net_paid,0)) as decimal(15,4) )) as currency_ratio
+ from
+ catalog_sales cs left outer join catalog_returns cr
+ on (cs.cs_order_number = cr.cr_order_number and
+ cs.cs_item_sk = cr.cr_item_sk)
+ ,date_dim
+ where
+ cr.cr_return_amount > 10000
+ and cs.cs_net_profit > 1
+ and cs.cs_net_paid > 0
+ and cs.cs_quantity > 0
+ and cs_sold_date_sk = d_date_sk
+ and d_year = 2000
+ and d_moy = 12
+ group by cs.cs_item_sk
+ ) in_cat
+ ) catalog
+ where
+ (
+ catalog.return_rank <= 10
+ or
+ catalog.currency_rank <=10
+ )
+ union
+ select
+ 'store' as channel
+ ,store.item as item
+ ,store.return_ratio as return_ratio
+ ,store.return_rank as return_rank
+ ,store.currency_rank as currency_rank
+ from (
+ select
+ item
+ ,return_ratio
+ ,currency_ratio
+ ,rank() over (order by return_ratio) as return_rank
+ ,rank() over (order by currency_ratio) as currency_rank
+ from
+ ( select sts.ss_item_sk as item
+ ,(cast(sum(coalesce(sr.sr_return_quantity,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_quantity,0)) as decimal(15,4) )) as return_ratio
+ ,(cast(sum(coalesce(sr.sr_return_amt,0)) as decimal(15,4))/cast(sum(coalesce(sts.ss_net_paid,0)) as decimal(15,4) )) as currency_ratio
+ from
+ store_sales sts left outer join store_returns sr
+ on (sts.ss_ticket_number = sr.sr_ticket_number and sts.ss_item_sk = sr.sr_item_sk)
+ ,date_dim
+ where
+ sr.sr_return_amt > 10000
+ and sts.ss_net_profit > 1
+ and sts.ss_net_paid > 0
+ and sts.ss_quantity > 0
+ and ss_sold_date_sk = d_date_sk
+ and d_year = 2000
+ and d_moy = 12
+ group by sts.ss_item_sk
+ ) in_store
+ ) store
+ where (
+ store.return_rank <= 10
+ or
+ store.currency_rank <= 10
+ )
+ ) y
+ order by 1,4,5,2
+ limit 100;
+
+-- end query 1 in stream 0 using template query49.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query5.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query5.sql
new file mode 100644
index 0000000000..f8428f6e54
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query5.sql
@@ -0,0 +1,128 @@
+-- start query 1 in stream 0 using template query5.tpl and seed 1819994127
+with ssr as
+ (select s_store_id,
+ sum(sales_price) as sales,
+ sum(profit) as profit,
+ sum(return_amt) as returns,
+ sum(net_loss) as profit_loss
+ from
+ ( select ss_store_sk as store_sk,
+ ss_sold_date_sk as date_sk,
+ ss_ext_sales_price as sales_price,
+ ss_net_profit as profit,
+ cast(0 as decimal(7,2)) as return_amt,
+ cast(0 as decimal(7,2)) as net_loss
+ from store_sales
+ union all
+ select sr_store_sk as store_sk,
+ sr_returned_date_sk as date_sk,
+ cast(0 as decimal(7,2)) as sales_price,
+ cast(0 as decimal(7,2)) as profit,
+ sr_return_amt as return_amt,
+ sr_net_loss as net_loss
+ from store_returns
+ ) salesreturns,
+ date_dim,
+ store
+ where date_sk = d_date_sk
+ and d_date between cast('2000-08-19' as date)
+ and (cast('2000-08-19' as date) + 14 days)
+ and store_sk = s_store_sk
+ group by s_store_id)
+ ,
+ csr as
+ (select cp_catalog_page_id,
+ sum(sales_price) as sales,
+ sum(profit) as profit,
+ sum(return_amt) as returns,
+ sum(net_loss) as profit_loss
+ from
+ ( select cs_catalog_page_sk as page_sk,
+ cs_sold_date_sk as date_sk,
+ cs_ext_sales_price as sales_price,
+ cs_net_profit as profit,
+ cast(0 as decimal(7,2)) as return_amt,
+ cast(0 as decimal(7,2)) as net_loss
+ from catalog_sales
+ union all
+ select cr_catalog_page_sk as page_sk,
+ cr_returned_date_sk as date_sk,
+ cast(0 as decimal(7,2)) as sales_price,
+ cast(0 as decimal(7,2)) as profit,
+ cr_return_amount as return_amt,
+ cr_net_loss as net_loss
+ from catalog_returns
+ ) salesreturns,
+ date_dim,
+ catalog_page
+ where date_sk = d_date_sk
+ and d_date between cast('2000-08-19' as date)
+ and (cast('2000-08-19' as date) + 14 days)
+ and page_sk = cp_catalog_page_sk
+ group by cp_catalog_page_id)
+ ,
+ wsr as
+ (select web_site_id,
+ sum(sales_price) as sales,
+ sum(profit) as profit,
+ sum(return_amt) as returns,
+ sum(net_loss) as profit_loss
+ from
+ ( select ws_web_site_sk as wsr_web_site_sk,
+ ws_sold_date_sk as date_sk,
+ ws_ext_sales_price as sales_price,
+ ws_net_profit as profit,
+ cast(0 as decimal(7,2)) as return_amt,
+ cast(0 as decimal(7,2)) as net_loss
+ from web_sales
+ union all
+ select ws_web_site_sk as wsr_web_site_sk,
+ wr_returned_date_sk as date_sk,
+ cast(0 as decimal(7,2)) as sales_price,
+ cast(0 as decimal(7,2)) as profit,
+ wr_return_amt as return_amt,
+ wr_net_loss as net_loss
+ from web_returns left outer join web_sales on
+ ( wr_item_sk = ws_item_sk
+ and wr_order_number = ws_order_number)
+ ) salesreturns,
+ date_dim,
+ web_site
+ where date_sk = d_date_sk
+ and d_date between cast('2000-08-19' as date)
+ and (cast('2000-08-19' as date) + 14 days)
+ and wsr_web_site_sk = web_site_sk
+ group by web_site_id)
+ select channel
+ , id
+ , sum(sales) as sales
+ , sum(returns) as returns
+ , sum(profit) as profit
+ from
+ (select 'store channel' as channel
+ , 'store' || s_store_id as id
+ , sales
+ , returns
+ , (profit - profit_loss) as profit
+ from ssr
+ union all
+ select 'catalog channel' as channel
+ , 'catalog_page' || cp_catalog_page_id as id
+ , sales
+ , returns
+ , (profit - profit_loss) as profit
+ from csr
+ union all
+ select 'web channel' as channel
+ , 'web_site' || web_site_id as id
+ , sales
+ , returns
+ , (profit - profit_loss) as profit
+ from wsr
+ ) x
+ group by rollup (channel, id)
+ order by channel
+ ,id
+ limit 100;
+
+-- end query 1 in stream 0 using template query5.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query50.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query50.sql
new file mode 100644
index 0000000000..ea694397af
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query50.sql
@@ -0,0 +1,59 @@
+-- start query 1 in stream 0 using template query50.tpl and seed 1819994127
+select
+ s_store_name
+ ,s_company_id
+ ,s_street_number
+ ,s_street_name
+ ,s_street_type
+ ,s_suite_number
+ ,s_city
+ ,s_county
+ ,s_state
+ ,s_zip
+ ,sum(case when (sr_returned_date_sk - ss_sold_date_sk <= 30 ) then 1 else 0 end) as `30 days`
+ ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 30) and
+ (sr_returned_date_sk - ss_sold_date_sk <= 60) then 1 else 0 end ) as `31-60 days`
+ ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 60) and
+ (sr_returned_date_sk - ss_sold_date_sk <= 90) then 1 else 0 end) as `61-90 days`
+ ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 90) and
+ (sr_returned_date_sk - ss_sold_date_sk <= 120) then 1 else 0 end) as `91-120 days`
+ ,sum(case when (sr_returned_date_sk - ss_sold_date_sk > 120) then 1 else 0 end) as `>120 days`
+from
+ store_sales
+ ,store_returns
+ ,store
+ ,date_dim d1
+ ,date_dim d2
+where
+ d2.d_year = 1998
+and d2.d_moy = 9
+and ss_ticket_number = sr_ticket_number
+and ss_item_sk = sr_item_sk
+and ss_sold_date_sk = d1.d_date_sk
+and sr_returned_date_sk = d2.d_date_sk
+and ss_customer_sk = sr_customer_sk
+and ss_store_sk = s_store_sk
+group by
+ s_store_name
+ ,s_company_id
+ ,s_street_number
+ ,s_street_name
+ ,s_street_type
+ ,s_suite_number
+ ,s_city
+ ,s_county
+ ,s_state
+ ,s_zip
+order by s_store_name
+ ,s_company_id
+ ,s_street_number
+ ,s_street_name
+ ,s_street_type
+ ,s_suite_number
+ ,s_city
+ ,s_county
+ ,s_state
+ ,s_zip
+limit 100;
+
+-- end query 1 in stream 0 using template query50.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query51.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query51.sql
new file mode 100644
index 0000000000..dbf9807f5d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query51.sql
@@ -0,0 +1,45 @@
+-- start query 1 in stream 0 using template query51.tpl and seed 1819994127
+WITH web_v1 as (
+select
+ ws_item_sk item_sk, d_date,
+ sum(sum(ws_sales_price))
+ over (partition by ws_item_sk order by d_date rows between unbounded preceding and current row) cume_sales
+from web_sales
+ ,date_dim
+where ws_sold_date_sk=d_date_sk
+ and d_month_seq between 1214 and 1214+11
+ and ws_item_sk is not NULL
+group by ws_item_sk, d_date),
+store_v1 as (
+select
+ ss_item_sk item_sk, d_date,
+ sum(sum(ss_sales_price))
+ over (partition by ss_item_sk order by d_date rows between unbounded preceding and current row) cume_sales
+from store_sales
+ ,date_dim
+where ss_sold_date_sk=d_date_sk
+ and d_month_seq between 1214 and 1214+11
+ and ss_item_sk is not NULL
+group by ss_item_sk, d_date)
+ select *
+from (select item_sk
+ ,d_date
+ ,web_sales
+ ,store_sales
+ ,max(web_sales)
+ over (partition by item_sk order by d_date rows between unbounded preceding and current row) web_cumulative
+ ,max(store_sales)
+ over (partition by item_sk order by d_date rows between unbounded preceding and current row) store_cumulative
+ from (select case when web.item_sk is not null then web.item_sk else store.item_sk end item_sk
+ ,case when web.d_date is not null then web.d_date else store.d_date end d_date
+ ,web.cume_sales web_sales
+ ,store.cume_sales store_sales
+ from web_v1 web full outer join store_v1 store on (web.item_sk = store.item_sk
+ and web.d_date = store.d_date)
+ )x )y
+where web_cumulative > store_cumulative
+order by item_sk
+ ,d_date
+limit 100;
+
+-- end query 1 in stream 0 using template query51.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query52.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query52.sql
new file mode 100644
index 0000000000..316e40e67e
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query52.sql
@@ -0,0 +1,22 @@
+-- start query 1 in stream 0 using template query52.tpl and seed 1819994127
+select dt.d_year
+ ,item.i_brand_id brand_id
+ ,item.i_brand brand
+ ,sum(ss_ext_sales_price) ext_price
+ from date_dim dt
+ ,store_sales
+ ,item
+ where dt.d_date_sk = store_sales.ss_sold_date_sk
+ and store_sales.ss_item_sk = item.i_item_sk
+ and item.i_manager_id = 1
+ and dt.d_moy=12
+ and dt.d_year=2000
+ group by dt.d_year
+ ,item.i_brand
+ ,item.i_brand_id
+ order by dt.d_year
+ ,ext_price desc
+ ,brand_id
+limit 100 ;
+
+-- end query 1 in stream 0 using template query52.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query53.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query53.sql
new file mode 100644
index 0000000000..ab08dbd4fb
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query53.sql
@@ -0,0 +1,28 @@
+-- start query 1 in stream 0 using template query53.tpl and seed 1819994127
+select * from
+(select i_manufact_id,
+sum(ss_sales_price) sum_sales,
+avg(sum(ss_sales_price)) over (partition by i_manufact_id) avg_quarterly_sales
+from item, store_sales, date_dim, store
+where ss_item_sk = i_item_sk and
+ss_sold_date_sk = d_date_sk and
+ss_store_sk = s_store_sk and
+d_month_seq in (1212,1212+1,1212+2,1212+3,1212+4,1212+5,1212+6,1212+7,1212+8,1212+9,1212+10,1212+11) and
+((i_category in ('Books','Children','Electronics') and
+i_class in ('personal','portable','reference','self-help') and
+i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7',
+ 'exportiunivamalg #9','scholaramalgamalg #9'))
+or(i_category in ('Women','Music','Men') and
+i_class in ('accessories','classical','fragrances','pants') and
+i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1',
+ 'importoamalg #1')))
+group by i_manufact_id, d_qoy ) tmp1
+where case when avg_quarterly_sales > 0
+ then abs (sum_sales - avg_quarterly_sales)/ avg_quarterly_sales
+ else null end > 0.1
+order by avg_quarterly_sales,
+ sum_sales,
+ i_manufact_id
+limit 100;
+
+-- end query 1 in stream 0 using template query53.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query54.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query54.sql
new file mode 100644
index 0000000000..453c5110ec
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query54.sql
@@ -0,0 +1,56 @@
+-- start query 1 in stream 0 using template query54.tpl and seed 1930872976
+with my_customers as (
+ select distinct c_customer_sk
+ , c_current_addr_sk
+ from
+ ( select cs_sold_date_sk sold_date_sk,
+ cs_bill_customer_sk customer_sk,
+ cs_item_sk item_sk
+ from catalog_sales
+ union all
+ select ws_sold_date_sk sold_date_sk,
+ ws_bill_customer_sk customer_sk,
+ ws_item_sk item_sk
+ from web_sales
+ ) cs_or_ws_sales,
+ item,
+ date_dim,
+ customer
+ where sold_date_sk = d_date_sk
+ and item_sk = i_item_sk
+ and i_category = 'Books'
+ and i_class = 'business'
+ and c_customer_sk = cs_or_ws_sales.customer_sk
+ and d_moy = 2
+ and d_year = 2000
+ )
+ , my_revenue as (
+ select c_customer_sk,
+ sum(ss_ext_sales_price) as revenue
+ from my_customers,
+ store_sales,
+ customer_address,
+ store,
+ date_dim
+ where c_current_addr_sk = ca_address_sk
+ and ca_county = s_county
+ and ca_state = s_state
+ and ss_sold_date_sk = d_date_sk
+ and c_customer_sk = ss_customer_sk
+ and d_month_seq between (select distinct d_month_seq+1
+ from date_dim where d_year = 2000 and d_moy = 2)
+ and (select distinct d_month_seq+3
+ from date_dim where d_year = 2000 and d_moy = 2)
+ group by c_customer_sk
+ )
+ , segments as
+ (select cast((revenue/50) as int) as segment
+ from my_revenue
+ )
+ select segment, count(*) as num_customers, segment*50 as segment_base
+ from segments
+ group by segment
+ order by segment, num_customers
+ limit 100;
+
+-- end query 1 in stream 0 using template query54.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query55.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query55.sql
new file mode 100644
index 0000000000..09f2b7cf41
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query55.sql
@@ -0,0 +1,14 @@
+-- start query 1 in stream 0 using template query55.tpl and seed 2031708268
+select i_brand_id brand_id, i_brand brand,
+ sum(ss_ext_sales_price) ext_price
+ from date_dim, store_sales, item
+ where d_date_sk = ss_sold_date_sk
+ and ss_item_sk = i_item_sk
+ and i_manager_id=13
+ and d_moy=11
+ and d_year=1999
+ group by i_brand, i_brand_id
+ order by ext_price desc, i_brand_id
+limit 100 ;
+
+-- end query 1 in stream 0 using template query55.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query56.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query56.sql
new file mode 100644
index 0000000000..a0e245c421
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query56.sql
@@ -0,0 +1,69 @@
+-- start query 1 in stream 0 using template query56.tpl and seed 1951559352
+with ss as (
+ select i_item_id,sum(ss_ext_sales_price) total_sales
+ from
+ store_sales,
+ date_dim,
+ customer_address,
+ item
+ where i_item_id in (select
+ i_item_id
+from item
+where i_color in ('chiffon','smoke','lace'))
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year = 2001
+ and d_moy = 5
+ and ss_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_item_id),
+ cs as (
+ select i_item_id,sum(cs_ext_sales_price) total_sales
+ from
+ catalog_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_item_id in (select
+ i_item_id
+from item
+where i_color in ('chiffon','smoke','lace'))
+ and cs_item_sk = i_item_sk
+ and cs_sold_date_sk = d_date_sk
+ and d_year = 2001
+ and d_moy = 5
+ and cs_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_item_id),
+ ws as (
+ select i_item_id,sum(ws_ext_sales_price) total_sales
+ from
+ web_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_item_id in (select
+ i_item_id
+from item
+where i_color in ('chiffon','smoke','lace'))
+ and ws_item_sk = i_item_sk
+ and ws_sold_date_sk = d_date_sk
+ and d_year = 2001
+ and d_moy = 5
+ and ws_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -6
+ group by i_item_id)
+ select i_item_id ,sum(total_sales) total_sales
+ from (select * from ss
+ union all
+ select * from cs
+ union all
+ select * from ws) tmp1
+ group by i_item_id
+ order by total_sales,
+ i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query56.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query57.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query57.sql
new file mode 100644
index 0000000000..10602da67c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query57.sql
@@ -0,0 +1,48 @@
+-- start query 1 in stream 0 using template query57.tpl and seed 2031708268
+with v1 as(
+ select i_category, i_brand,
+ cc_name,
+ d_year, d_moy,
+ sum(cs_sales_price) sum_sales,
+ avg(sum(cs_sales_price)) over
+ (partition by i_category, i_brand,
+ cc_name, d_year)
+ avg_monthly_sales,
+ rank() over
+ (partition by i_category, i_brand,
+ cc_name
+ order by d_year, d_moy) rn
+ from item, catalog_sales, date_dim, call_center
+ where cs_item_sk = i_item_sk and
+ cs_sold_date_sk = d_date_sk and
+ cc_call_center_sk= cs_call_center_sk and
+ (
+ d_year = 1999 or
+ ( d_year = 1999-1 and d_moy =12) or
+ ( d_year = 1999+1 and d_moy =1)
+ )
+ group by i_category, i_brand,
+ cc_name , d_year, d_moy),
+ v2 as(
+ select v1.i_category, v1.i_brand
+ ,v1.d_year, v1.d_moy
+ ,v1.avg_monthly_sales
+ ,v1.sum_sales, v1_lag.sum_sales psum, v1_lead.sum_sales nsum
+ from v1, v1 v1_lag, v1 v1_lead
+ where v1.i_category = v1_lag.i_category and
+ v1.i_category = v1_lead.i_category and
+ v1.i_brand = v1_lag.i_brand and
+ v1.i_brand = v1_lead.i_brand and
+ v1. cc_name = v1_lag. cc_name and
+ v1. cc_name = v1_lead. cc_name and
+ v1.rn = v1_lag.rn + 1 and
+ v1.rn = v1_lead.rn - 1)
+ select *
+ from v2
+ where d_year = 1999 and
+ avg_monthly_sales > 0 and
+ case when avg_monthly_sales > 0 then abs(sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1
+ order by sum_sales - avg_monthly_sales, avg_monthly_sales
+ limit 100;
+
+-- end query 1 in stream 0 using template query57.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query58.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query58.sql
new file mode 100644
index 0000000000..36a4359807
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query58.sql
@@ -0,0 +1,65 @@
+-- start query 1 in stream 0 using template query58.tpl and seed 1819994127
+with ss_items as
+ (select i_item_id item_id
+ ,sum(ss_ext_sales_price) ss_item_rev
+ from store_sales
+ ,item
+ ,date_dim
+ where ss_item_sk = i_item_sk
+ and d_date in (select d_date
+ from date_dim
+ where d_week_seq = (select d_week_seq
+ from date_dim
+ where d_date = '1998-02-21'))
+ and ss_sold_date_sk = d_date_sk
+ group by i_item_id),
+ cs_items as
+ (select i_item_id item_id
+ ,sum(cs_ext_sales_price) cs_item_rev
+ from catalog_sales
+ ,item
+ ,date_dim
+ where cs_item_sk = i_item_sk
+ and d_date in (select d_date
+ from date_dim
+ where d_week_seq = (select d_week_seq
+ from date_dim
+ where d_date = '1998-02-21'))
+ and cs_sold_date_sk = d_date_sk
+ group by i_item_id),
+ ws_items as
+ (select i_item_id item_id
+ ,sum(ws_ext_sales_price) ws_item_rev
+ from web_sales
+ ,item
+ ,date_dim
+ where ws_item_sk = i_item_sk
+ and d_date in (select d_date
+ from date_dim
+ where d_week_seq =(select d_week_seq
+ from date_dim
+ where d_date = '1998-02-21'))
+ and ws_sold_date_sk = d_date_sk
+ group by i_item_id)
+ select ss_items.item_id
+ ,ss_item_rev
+ ,ss_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ss_dev
+ ,cs_item_rev
+ ,cs_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 cs_dev
+ ,ws_item_rev
+ ,ws_item_rev/((ss_item_rev+cs_item_rev+ws_item_rev)/3) * 100 ws_dev
+ ,(ss_item_rev+cs_item_rev+ws_item_rev)/3 average
+ from ss_items,cs_items,ws_items
+ where ss_items.item_id=cs_items.item_id
+ and ss_items.item_id=ws_items.item_id
+ and ss_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
+ and ss_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
+ and cs_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
+ and cs_item_rev between 0.9 * ws_item_rev and 1.1 * ws_item_rev
+ and ws_item_rev between 0.9 * ss_item_rev and 1.1 * ss_item_rev
+ and ws_item_rev between 0.9 * cs_item_rev and 1.1 * cs_item_rev
+ order by item_id
+ ,ss_item_rev
+ limit 100;
+
+-- end query 1 in stream 0 using template query58.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query59.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query59.sql
new file mode 100644
index 0000000000..9e74b19b93
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query59.sql
@@ -0,0 +1,44 @@
+-- start query 1 in stream 0 using template query59.tpl and seed 1819994127
+with wss as
+ (select d_week_seq,
+ ss_store_sk,
+ sum(case when (d_day_name='Sunday') then ss_sales_price else null end) sun_sales,
+ sum(case when (d_day_name='Monday') then ss_sales_price else null end) mon_sales,
+ sum(case when (d_day_name='Tuesday') then ss_sales_price else null end) tue_sales,
+ sum(case when (d_day_name='Wednesday') then ss_sales_price else null end) wed_sales,
+ sum(case when (d_day_name='Thursday') then ss_sales_price else null end) thu_sales,
+ sum(case when (d_day_name='Friday') then ss_sales_price else null end) fri_sales,
+ sum(case when (d_day_name='Saturday') then ss_sales_price else null end) sat_sales
+ from store_sales,date_dim
+ where d_date_sk = ss_sold_date_sk
+ group by d_week_seq,ss_store_sk
+ )
+ select s_store_name1,s_store_id1,d_week_seq1
+ ,sun_sales1/sun_sales2,mon_sales1/mon_sales2
+ ,tue_sales1/tue_sales2,wed_sales1/wed_sales2,thu_sales1/thu_sales2
+ ,fri_sales1/fri_sales2,sat_sales1/sat_sales2
+ from
+ (select s_store_name s_store_name1,wss.d_week_seq d_week_seq1
+ ,s_store_id s_store_id1,sun_sales sun_sales1
+ ,mon_sales mon_sales1,tue_sales tue_sales1
+ ,wed_sales wed_sales1,thu_sales thu_sales1
+ ,fri_sales fri_sales1,sat_sales sat_sales1
+ from wss,store,date_dim d
+ where d.d_week_seq = wss.d_week_seq and
+ ss_store_sk = s_store_sk and
+ d_month_seq between 1205 and 1205 + 11) y,
+ (select s_store_name s_store_name2,wss.d_week_seq d_week_seq2
+ ,s_store_id s_store_id2,sun_sales sun_sales2
+ ,mon_sales mon_sales2,tue_sales tue_sales2
+ ,wed_sales wed_sales2,thu_sales thu_sales2
+ ,fri_sales fri_sales2,sat_sales sat_sales2
+ from wss,store,date_dim d
+ where d.d_week_seq = wss.d_week_seq and
+ ss_store_sk = s_store_sk and
+ d_month_seq between 1205+ 12 and 1205 + 23) x
+ where s_store_id1=s_store_id2
+ and d_week_seq1=d_week_seq2-52
+ order by s_store_name1,s_store_id1,d_week_seq1
+limit 100;
+
+-- end query 1 in stream 0 using template query59.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query6.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query6.sql
new file mode 100644
index 0000000000..21a8a618cd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query6.sql
@@ -0,0 +1,26 @@
+-- start query 1 in stream 0 using template query6.tpl and seed 1819994127
+select a.ca_state state, count(*) cnt
+ from customer_address a
+ ,customer c
+ ,store_sales s
+ ,date_dim d
+ ,item i
+ where a.ca_address_sk = c.c_current_addr_sk
+ and c.c_customer_sk = s.ss_customer_sk
+ and s.ss_sold_date_sk = d.d_date_sk
+ and s.ss_item_sk = i.i_item_sk
+ and d.d_month_seq =
+ (select distinct (d_month_seq)
+ from date_dim
+ where d_year = 2002
+ and d_moy = 3 )
+ and i.i_current_price > 1.2 *
+ (select avg(j.i_current_price)
+ from item j
+ where j.i_category = i.i_category)
+ group by a.ca_state
+ having count(*) >= 10
+ order by cnt, a.ca_state
+ limit 100;
+
+-- end query 1 in stream 0 using template query6.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query60.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query60.sql
new file mode 100644
index 0000000000..0f96b97d55
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query60.sql
@@ -0,0 +1,78 @@
+-- start query 1 in stream 0 using template query60.tpl and seed 1930872976
+with ss as (
+ select
+ i_item_id,sum(ss_ext_sales_price) total_sales
+ from
+ store_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_item_id in (select
+ i_item_id
+from
+ item
+where i_category in ('Children'))
+ and ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 10
+ and ss_addr_sk = ca_address_sk
+ and ca_gmt_offset = -5
+ group by i_item_id),
+ cs as (
+ select
+ i_item_id,sum(cs_ext_sales_price) total_sales
+ from
+ catalog_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_item_id in (select
+ i_item_id
+from
+ item
+where i_category in ('Children'))
+ and cs_item_sk = i_item_sk
+ and cs_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 10
+ and cs_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -5
+ group by i_item_id),
+ ws as (
+ select
+ i_item_id,sum(ws_ext_sales_price) total_sales
+ from
+ web_sales,
+ date_dim,
+ customer_address,
+ item
+ where
+ i_item_id in (select
+ i_item_id
+from
+ item
+where i_category in ('Children'))
+ and ws_item_sk = i_item_sk
+ and ws_sold_date_sk = d_date_sk
+ and d_year = 1998
+ and d_moy = 10
+ and ws_bill_addr_sk = ca_address_sk
+ and ca_gmt_offset = -5
+ group by i_item_id)
+ select
+ i_item_id
+,sum(total_sales) total_sales
+ from (select * from ss
+ union all
+ select * from cs
+ union all
+ select * from ws) tmp1
+ group by i_item_id
+ order by i_item_id
+ ,total_sales
+ limit 100;
+
+-- end query 1 in stream 0 using template query60.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query61.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query61.sql
new file mode 100644
index 0000000000..4be7626638
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query61.sql
@@ -0,0 +1,44 @@
+-- start query 1 in stream 0 using template query61.tpl and seed 1930872976
+select promotions,total,cast(promotions as decimal(15,4))/cast(total as decimal(15,4))*100
+from
+ (select sum(ss_ext_sales_price) promotions
+ from store_sales
+ ,store
+ ,promotion
+ ,date_dim
+ ,customer
+ ,customer_address
+ ,item
+ where ss_sold_date_sk = d_date_sk
+ and ss_store_sk = s_store_sk
+ and ss_promo_sk = p_promo_sk
+ and ss_customer_sk= c_customer_sk
+ and ca_address_sk = c_current_addr_sk
+ and ss_item_sk = i_item_sk
+ and ca_gmt_offset = -6
+ and i_category = 'Sports'
+ and (p_channel_dmail = 'Y' or p_channel_email = 'Y' or p_channel_tv = 'Y')
+ and s_gmt_offset = -6
+ and d_year = 2001
+ and d_moy = 12) promotional_sales,
+ (select sum(ss_ext_sales_price) total
+ from store_sales
+ ,store
+ ,date_dim
+ ,customer
+ ,customer_address
+ ,item
+ where ss_sold_date_sk = d_date_sk
+ and ss_store_sk = s_store_sk
+ and ss_customer_sk= c_customer_sk
+ and ca_address_sk = c_current_addr_sk
+ and ss_item_sk = i_item_sk
+ and ca_gmt_offset = -6
+ and i_category = 'Sports'
+ and s_gmt_offset = -6
+ and d_year = 2001
+ and d_moy = 12) all_sales
+order by promotions, total
+limit 100;
+
+-- end query 1 in stream 0 using template query61.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query62.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query62.sql
new file mode 100644
index 0000000000..374256db8b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query62.sql
@@ -0,0 +1,35 @@
+-- start query 1 in stream 0 using template query62.tpl and seed 1819994127
+select
+ substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,web_name
+ ,sum(case when (ws_ship_date_sk - ws_sold_date_sk <= 30 ) then 1 else 0 end) as `30 days`
+ ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 30) and
+ (ws_ship_date_sk - ws_sold_date_sk <= 60) then 1 else 0 end ) as `31-60 days`
+ ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 60) and
+ (ws_ship_date_sk - ws_sold_date_sk <= 90) then 1 else 0 end) as `61-90 days`
+ ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 90) and
+ (ws_ship_date_sk - ws_sold_date_sk <= 120) then 1 else 0 end) as `91-120 days`
+ ,sum(case when (ws_ship_date_sk - ws_sold_date_sk > 120) then 1 else 0 end) as `>120 days`
+from
+ web_sales
+ ,warehouse
+ ,ship_mode
+ ,web_site
+ ,date_dim
+where
+ d_month_seq between 1215 and 1215 + 11
+and ws_ship_date_sk = d_date_sk
+and ws_warehouse_sk = w_warehouse_sk
+and ws_ship_mode_sk = sm_ship_mode_sk
+and ws_web_site_sk = web_site_sk
+group by
+ substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,web_name
+order by substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,web_name
+limit 100;
+
+-- end query 1 in stream 0 using template query62.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query63.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query63.sql
new file mode 100644
index 0000000000..599a2d0235
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query63.sql
@@ -0,0 +1,29 @@
+-- start query 1 in stream 0 using template query63.tpl and seed 1819994127
+select *
+from (select i_manager_id
+ ,sum(ss_sales_price) sum_sales
+ ,avg(sum(ss_sales_price)) over (partition by i_manager_id) avg_monthly_sales
+ from item
+ ,store_sales
+ ,date_dim
+ ,store
+ where ss_item_sk = i_item_sk
+ and ss_sold_date_sk = d_date_sk
+ and ss_store_sk = s_store_sk
+ and d_month_seq in (1211,1211+1,1211+2,1211+3,1211+4,1211+5,1211+6,1211+7,1211+8,1211+9,1211+10,1211+11)
+ and (( i_category in ('Books','Children','Electronics')
+ and i_class in ('personal','portable','reference','self-help')
+ and i_brand in ('scholaramalgamalg #14','scholaramalgamalg #7',
+ 'exportiunivamalg #9','scholaramalgamalg #9'))
+ or( i_category in ('Women','Music','Men')
+ and i_class in ('accessories','classical','fragrances','pants')
+ and i_brand in ('amalgimporto #1','edu packscholar #1','exportiimporto #1',
+ 'importoamalg #1')))
+group by i_manager_id, d_moy) tmp1
+where case when avg_monthly_sales > 0 then abs (sum_sales - avg_monthly_sales) / avg_monthly_sales else null end > 0.1
+order by i_manager_id
+ ,avg_monthly_sales
+ ,sum_sales
+limit 100;
+
+-- end query 1 in stream 0 using template query63.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query64.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query64.sql
new file mode 100644
index 0000000000..e353b930dd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query64.sql
@@ -0,0 +1,121 @@
+-- start query 1 in stream 0 using template query64.tpl and seed 1220860970
+with cs_ui as
+ (select cs_item_sk
+ ,sum(cs_ext_list_price) as sale,sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit) as refund
+ from catalog_sales
+ ,catalog_returns
+ where cs_item_sk = cr_item_sk
+ and cs_order_number = cr_order_number
+ group by cs_item_sk
+ having sum(cs_ext_list_price)>2*sum(cr_refunded_cash+cr_reversed_charge+cr_store_credit)),
+cross_sales as
+ (select i_product_name product_name
+ ,i_item_sk item_sk
+ ,s_store_name store_name
+ ,s_zip store_zip
+ ,ad1.ca_street_number b_street_number
+ ,ad1.ca_street_name b_street_name
+ ,ad1.ca_city b_city
+ ,ad1.ca_zip b_zip
+ ,ad2.ca_street_number c_street_number
+ ,ad2.ca_street_name c_street_name
+ ,ad2.ca_city c_city
+ ,ad2.ca_zip c_zip
+ ,d1.d_year as syear
+ ,d2.d_year as fsyear
+ ,d3.d_year s2year
+ ,count(*) cnt
+ ,sum(ss_wholesale_cost) s1
+ ,sum(ss_list_price) s2
+ ,sum(ss_coupon_amt) s3
+ FROM store_sales
+ ,store_returns
+ ,cs_ui
+ ,date_dim d1
+ ,date_dim d2
+ ,date_dim d3
+ ,store
+ ,customer
+ ,customer_demographics cd1
+ ,customer_demographics cd2
+ ,promotion
+ ,household_demographics hd1
+ ,household_demographics hd2
+ ,customer_address ad1
+ ,customer_address ad2
+ ,income_band ib1
+ ,income_band ib2
+ ,item
+ WHERE ss_store_sk = s_store_sk AND
+ ss_sold_date_sk = d1.d_date_sk AND
+ ss_customer_sk = c_customer_sk AND
+ ss_cdemo_sk= cd1.cd_demo_sk AND
+ ss_hdemo_sk = hd1.hd_demo_sk AND
+ ss_addr_sk = ad1.ca_address_sk and
+ ss_item_sk = i_item_sk and
+ ss_item_sk = sr_item_sk and
+ ss_ticket_number = sr_ticket_number and
+ ss_item_sk = cs_ui.cs_item_sk and
+ c_current_cdemo_sk = cd2.cd_demo_sk AND
+ c_current_hdemo_sk = hd2.hd_demo_sk AND
+ c_current_addr_sk = ad2.ca_address_sk and
+ c_first_sales_date_sk = d2.d_date_sk and
+ c_first_shipto_date_sk = d3.d_date_sk and
+ ss_promo_sk = p_promo_sk and
+ hd1.hd_income_band_sk = ib1.ib_income_band_sk and
+ hd2.hd_income_band_sk = ib2.ib_income_band_sk and
+ cd1.cd_marital_status <> cd2.cd_marital_status and
+ i_color in ('azure','gainsboro','misty','blush','hot','lemon') and
+ i_current_price between 80 and 80 + 10 and
+ i_current_price between 80 + 1 and 80 + 15
+group by i_product_name
+ ,i_item_sk
+ ,s_store_name
+ ,s_zip
+ ,ad1.ca_street_number
+ ,ad1.ca_street_name
+ ,ad1.ca_city
+ ,ad1.ca_zip
+ ,ad2.ca_street_number
+ ,ad2.ca_street_name
+ ,ad2.ca_city
+ ,ad2.ca_zip
+ ,d1.d_year
+ ,d2.d_year
+ ,d3.d_year
+)
+select cs1.product_name
+ ,cs1.store_name
+ ,cs1.store_zip
+ ,cs1.b_street_number
+ ,cs1.b_street_name
+ ,cs1.b_city
+ ,cs1.b_zip
+ ,cs1.c_street_number
+ ,cs1.c_street_name
+ ,cs1.c_city
+ ,cs1.c_zip
+ ,cs1.syear
+ ,cs1.cnt
+ ,cs1.s1 as s11
+ ,cs1.s2 as s21
+ ,cs1.s3 as s31
+ ,cs2.s1 as s12
+ ,cs2.s2 as s22
+ ,cs2.s3 as s32
+ ,cs2.syear
+ ,cs2.cnt
+from cross_sales cs1,cross_sales cs2
+where cs1.item_sk=cs2.item_sk and
+ cs1.syear = 1999 and
+ cs2.syear = 1999 + 1 and
+ cs2.cnt <= cs1.cnt and
+ cs1.store_name = cs2.store_name and
+ cs1.store_zip = cs2.store_zip
+order by cs1.product_name
+ ,cs1.store_name
+ ,cs2.cnt
+ ,cs1.s1
+ ,cs2.s1;
+
+-- end query 1 in stream 0 using template query64.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query65.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query65.sql
new file mode 100644
index 0000000000..826ecc6445
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query65.sql
@@ -0,0 +1,29 @@
+-- start query 1 in stream 0 using template query65.tpl and seed 1819994127
+select
+ s_store_name,
+ i_item_desc,
+ sc.revenue,
+ i_current_price,
+ i_wholesale_cost,
+ i_brand
+ from store, item,
+ (select ss_store_sk, avg(revenue) as ave
+ from
+ (select ss_store_sk, ss_item_sk,
+ sum(ss_sales_price) as revenue
+ from store_sales, date_dim
+ where ss_sold_date_sk = d_date_sk and d_month_seq between 1186 and 1186+11
+ group by ss_store_sk, ss_item_sk) sa
+ group by ss_store_sk) sb,
+ (select ss_store_sk, ss_item_sk, sum(ss_sales_price) as revenue
+ from store_sales, date_dim
+ where ss_sold_date_sk = d_date_sk and d_month_seq between 1186 and 1186+11
+ group by ss_store_sk, ss_item_sk) sc
+ where sb.ss_store_sk = sc.ss_store_sk and
+ sc.revenue <= 0.1 * sb.ave and
+ s_store_sk = sc.ss_store_sk and
+ i_item_sk = sc.ss_item_sk
+ order by s_store_name, i_item_desc
+limit 100;
+
+-- end query 1 in stream 0 using template query65.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query66.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query66.sql
new file mode 100644
index 0000000000..987238b125
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query66.sql
@@ -0,0 +1,220 @@
+-- start query 1 in stream 0 using template query66.tpl and seed 2042478054
+select
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,ship_carriers
+ ,year
+ ,sum(jan_sales) as jan_sales
+ ,sum(feb_sales) as feb_sales
+ ,sum(mar_sales) as mar_sales
+ ,sum(apr_sales) as apr_sales
+ ,sum(may_sales) as may_sales
+ ,sum(jun_sales) as jun_sales
+ ,sum(jul_sales) as jul_sales
+ ,sum(aug_sales) as aug_sales
+ ,sum(sep_sales) as sep_sales
+ ,sum(oct_sales) as oct_sales
+ ,sum(nov_sales) as nov_sales
+ ,sum(dec_sales) as dec_sales
+ ,sum(jan_sales/w_warehouse_sq_ft) as jan_sales_per_sq_foot
+ ,sum(feb_sales/w_warehouse_sq_ft) as feb_sales_per_sq_foot
+ ,sum(mar_sales/w_warehouse_sq_ft) as mar_sales_per_sq_foot
+ ,sum(apr_sales/w_warehouse_sq_ft) as apr_sales_per_sq_foot
+ ,sum(may_sales/w_warehouse_sq_ft) as may_sales_per_sq_foot
+ ,sum(jun_sales/w_warehouse_sq_ft) as jun_sales_per_sq_foot
+ ,sum(jul_sales/w_warehouse_sq_ft) as jul_sales_per_sq_foot
+ ,sum(aug_sales/w_warehouse_sq_ft) as aug_sales_per_sq_foot
+ ,sum(sep_sales/w_warehouse_sq_ft) as sep_sales_per_sq_foot
+ ,sum(oct_sales/w_warehouse_sq_ft) as oct_sales_per_sq_foot
+ ,sum(nov_sales/w_warehouse_sq_ft) as nov_sales_per_sq_foot
+ ,sum(dec_sales/w_warehouse_sq_ft) as dec_sales_per_sq_foot
+ ,sum(jan_net) as jan_net
+ ,sum(feb_net) as feb_net
+ ,sum(mar_net) as mar_net
+ ,sum(apr_net) as apr_net
+ ,sum(may_net) as may_net
+ ,sum(jun_net) as jun_net
+ ,sum(jul_net) as jul_net
+ ,sum(aug_net) as aug_net
+ ,sum(sep_net) as sep_net
+ ,sum(oct_net) as oct_net
+ ,sum(nov_net) as nov_net
+ ,sum(dec_net) as dec_net
+ from (
+ select
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,'MSC' || ',' || 'GERMA' as ship_carriers
+ ,d_year as year
+ ,sum(case when d_moy = 1
+ then ws_sales_price* ws_quantity else 0 end) as jan_sales
+ ,sum(case when d_moy = 2
+ then ws_sales_price* ws_quantity else 0 end) as feb_sales
+ ,sum(case when d_moy = 3
+ then ws_sales_price* ws_quantity else 0 end) as mar_sales
+ ,sum(case when d_moy = 4
+ then ws_sales_price* ws_quantity else 0 end) as apr_sales
+ ,sum(case when d_moy = 5
+ then ws_sales_price* ws_quantity else 0 end) as may_sales
+ ,sum(case when d_moy = 6
+ then ws_sales_price* ws_quantity else 0 end) as jun_sales
+ ,sum(case when d_moy = 7
+ then ws_sales_price* ws_quantity else 0 end) as jul_sales
+ ,sum(case when d_moy = 8
+ then ws_sales_price* ws_quantity else 0 end) as aug_sales
+ ,sum(case when d_moy = 9
+ then ws_sales_price* ws_quantity else 0 end) as sep_sales
+ ,sum(case when d_moy = 10
+ then ws_sales_price* ws_quantity else 0 end) as oct_sales
+ ,sum(case when d_moy = 11
+ then ws_sales_price* ws_quantity else 0 end) as nov_sales
+ ,sum(case when d_moy = 12
+ then ws_sales_price* ws_quantity else 0 end) as dec_sales
+ ,sum(case when d_moy = 1
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jan_net
+ ,sum(case when d_moy = 2
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as feb_net
+ ,sum(case when d_moy = 3
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as mar_net
+ ,sum(case when d_moy = 4
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as apr_net
+ ,sum(case when d_moy = 5
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as may_net
+ ,sum(case when d_moy = 6
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jun_net
+ ,sum(case when d_moy = 7
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as jul_net
+ ,sum(case when d_moy = 8
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as aug_net
+ ,sum(case when d_moy = 9
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as sep_net
+ ,sum(case when d_moy = 10
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as oct_net
+ ,sum(case when d_moy = 11
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as nov_net
+ ,sum(case when d_moy = 12
+ then ws_net_paid_inc_ship_tax * ws_quantity else 0 end) as dec_net
+ from
+ web_sales
+ ,warehouse
+ ,date_dim
+ ,time_dim
+ ,ship_mode
+ where
+ ws_warehouse_sk = w_warehouse_sk
+ and ws_sold_date_sk = d_date_sk
+ and ws_sold_time_sk = t_time_sk
+ and ws_ship_mode_sk = sm_ship_mode_sk
+ and d_year = 2001
+ and t_time between 9453 and 9453+28800
+ and sm_carrier in ('MSC','GERMA')
+ group by
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,d_year
+ union all
+ select
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,'MSC' || ',' || 'GERMA' as ship_carriers
+ ,d_year as year
+ ,sum(case when d_moy = 1
+ then cs_ext_list_price* cs_quantity else 0 end) as jan_sales
+ ,sum(case when d_moy = 2
+ then cs_ext_list_price* cs_quantity else 0 end) as feb_sales
+ ,sum(case when d_moy = 3
+ then cs_ext_list_price* cs_quantity else 0 end) as mar_sales
+ ,sum(case when d_moy = 4
+ then cs_ext_list_price* cs_quantity else 0 end) as apr_sales
+ ,sum(case when d_moy = 5
+ then cs_ext_list_price* cs_quantity else 0 end) as may_sales
+ ,sum(case when d_moy = 6
+ then cs_ext_list_price* cs_quantity else 0 end) as jun_sales
+ ,sum(case when d_moy = 7
+ then cs_ext_list_price* cs_quantity else 0 end) as jul_sales
+ ,sum(case when d_moy = 8
+ then cs_ext_list_price* cs_quantity else 0 end) as aug_sales
+ ,sum(case when d_moy = 9
+ then cs_ext_list_price* cs_quantity else 0 end) as sep_sales
+ ,sum(case when d_moy = 10
+ then cs_ext_list_price* cs_quantity else 0 end) as oct_sales
+ ,sum(case when d_moy = 11
+ then cs_ext_list_price* cs_quantity else 0 end) as nov_sales
+ ,sum(case when d_moy = 12
+ then cs_ext_list_price* cs_quantity else 0 end) as dec_sales
+ ,sum(case when d_moy = 1
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as jan_net
+ ,sum(case when d_moy = 2
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as feb_net
+ ,sum(case when d_moy = 3
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as mar_net
+ ,sum(case when d_moy = 4
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as apr_net
+ ,sum(case when d_moy = 5
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as may_net
+ ,sum(case when d_moy = 6
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as jun_net
+ ,sum(case when d_moy = 7
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as jul_net
+ ,sum(case when d_moy = 8
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as aug_net
+ ,sum(case when d_moy = 9
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as sep_net
+ ,sum(case when d_moy = 10
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as oct_net
+ ,sum(case when d_moy = 11
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as nov_net
+ ,sum(case when d_moy = 12
+ then cs_net_paid_inc_ship * cs_quantity else 0 end) as dec_net
+ from
+ catalog_sales
+ ,warehouse
+ ,date_dim
+ ,time_dim
+ ,ship_mode
+ where
+ cs_warehouse_sk = w_warehouse_sk
+ and cs_sold_date_sk = d_date_sk
+ and cs_sold_time_sk = t_time_sk
+ and cs_ship_mode_sk = sm_ship_mode_sk
+ and d_year = 2001
+ and t_time between 9453 AND 9453+28800
+ and sm_carrier in ('MSC','GERMA')
+ group by
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,d_year
+ ) x
+ group by
+ w_warehouse_name
+ ,w_warehouse_sq_ft
+ ,w_city
+ ,w_county
+ ,w_state
+ ,w_country
+ ,ship_carriers
+ ,year
+ order by w_warehouse_name
+ limit 100;
+
+-- end query 1 in stream 0 using template query66.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query67.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query67.sql
new file mode 100644
index 0000000000..df485b9ce0
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query67.sql
@@ -0,0 +1,44 @@
+-- start query 1 in stream 0 using template query67.tpl and seed 1819994127
+select *
+from (select i_category
+ ,i_class
+ ,i_brand
+ ,i_product_name
+ ,d_year
+ ,d_qoy
+ ,d_moy
+ ,s_store_id
+ ,sumsales
+ ,rank() over (partition by i_category order by sumsales desc) rk
+ from (select i_category
+ ,i_class
+ ,i_brand
+ ,i_product_name
+ ,d_year
+ ,d_qoy
+ ,d_moy
+ ,s_store_id
+ ,sum(coalesce(ss_sales_price*ss_quantity,0)) sumsales
+ from store_sales
+ ,date_dim
+ ,store
+ ,item
+ where ss_sold_date_sk=d_date_sk
+ and ss_item_sk=i_item_sk
+ and ss_store_sk = s_store_sk
+ and d_month_seq between 1185 and 1185+11
+ group by rollup(i_category, i_class, i_brand, i_product_name, d_year, d_qoy, d_moy,s_store_id))dw1) dw2
+where rk <= 100
+order by i_category
+ ,i_class
+ ,i_brand
+ ,i_product_name
+ ,d_year
+ ,d_qoy
+ ,d_moy
+ ,s_store_id
+ ,sumsales
+ ,rk
+limit 100;
+
+-- end query 1 in stream 0 using template query67.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query68.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query68.sql
new file mode 100644
index 0000000000..9c16a7eedd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query68.sql
@@ -0,0 +1,42 @@
+-- start query 1 in stream 0 using template query68.tpl and seed 803547492
+select c_last_name
+ ,c_first_name
+ ,ca_city
+ ,bought_city
+ ,ss_ticket_number
+ ,extended_price
+ ,extended_tax
+ ,list_price
+ from (select ss_ticket_number
+ ,ss_customer_sk
+ ,ca_city bought_city
+ ,sum(ss_ext_sales_price) extended_price
+ ,sum(ss_ext_list_price) list_price
+ ,sum(ss_ext_tax) extended_tax
+ from store_sales
+ ,date_dim
+ ,store
+ ,household_demographics
+ ,customer_address
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_store_sk = store.s_store_sk
+ and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+ and store_sales.ss_addr_sk = customer_address.ca_address_sk
+ and date_dim.d_dom between 1 and 2
+ and (household_demographics.hd_dep_count = 4 or
+ household_demographics.hd_vehicle_count= 0)
+ and date_dim.d_year in (1999,1999+1,1999+2)
+ and store.s_city in ('Pleasant Hill','Bethel')
+ group by ss_ticket_number
+ ,ss_customer_sk
+ ,ss_addr_sk,ca_city) dn
+ ,customer
+ ,customer_address current_addr
+ where ss_customer_sk = c_customer_sk
+ and customer.c_current_addr_sk = current_addr.ca_address_sk
+ and current_addr.ca_city <> bought_city
+ order by c_last_name
+ ,ss_ticket_number
+ limit 100;
+
+-- end query 1 in stream 0 using template query68.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query69.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query69.sql
new file mode 100644
index 0000000000..441077440d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query69.sql
@@ -0,0 +1,47 @@
+-- start query 1 in stream 0 using template query69.tpl and seed 797269820
+select
+ cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ count(*) cnt1,
+ cd_purchase_estimate,
+ count(*) cnt2,
+ cd_credit_rating,
+ count(*) cnt3
+ from
+ customer c,customer_address ca,customer_demographics
+ where
+ c.c_current_addr_sk = ca.ca_address_sk and
+ ca_state in ('MO','MN','AZ') and
+ cd_demo_sk = c.c_current_cdemo_sk and
+ exists (select *
+ from store_sales,date_dim
+ where c.c_customer_sk = ss_customer_sk and
+ ss_sold_date_sk = d_date_sk and
+ d_year = 2003 and
+ d_moy between 2 and 2+2) and
+ (not exists (select *
+ from web_sales,date_dim
+ where c.c_customer_sk = ws_bill_customer_sk and
+ ws_sold_date_sk = d_date_sk and
+ d_year = 2003 and
+ d_moy between 2 and 2+2) and
+ not exists (select *
+ from catalog_sales,date_dim
+ where c.c_customer_sk = cs_ship_customer_sk and
+ cs_sold_date_sk = d_date_sk and
+ d_year = 2003 and
+ d_moy between 2 and 2+2))
+ group by cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ cd_purchase_estimate,
+ cd_credit_rating
+ order by cd_gender,
+ cd_marital_status,
+ cd_education_status,
+ cd_purchase_estimate,
+ cd_credit_rating
+ limit 100;
+
+-- end query 1 in stream 0 using template query69.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query7.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query7.sql
new file mode 100644
index 0000000000..f17231ebb1
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query7.sql
@@ -0,0 +1,21 @@
+-- start query 1 in stream 0 using template query7.tpl and seed 1930872976
+select i_item_id,
+ avg(ss_quantity) agg1,
+ avg(ss_list_price) agg2,
+ avg(ss_coupon_amt) agg3,
+ avg(ss_sales_price) agg4
+ from store_sales, customer_demographics, date_dim, item, promotion
+ where ss_sold_date_sk = d_date_sk and
+ ss_item_sk = i_item_sk and
+ ss_cdemo_sk = cd_demo_sk and
+ ss_promo_sk = p_promo_sk and
+ cd_gender = 'F' and
+ cd_marital_status = 'W' and
+ cd_education_status = 'College' and
+ (p_channel_email = 'N' or p_channel_event = 'N') and
+ d_year = 2001
+ group by i_item_id
+ order by i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query7.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query70.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query70.sql
new file mode 100644
index 0000000000..1d44fbd6a4
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query70.sql
@@ -0,0 +1,38 @@
+-- start query 1 in stream 0 using template query70.tpl and seed 1819994127
+select
+ sum(ss_net_profit) as total_sum
+ ,s_state
+ ,s_county
+ ,grouping(s_state)+grouping(s_county) as lochierarchy
+ ,rank() over (
+ partition by grouping(s_state)+grouping(s_county),
+ case when grouping(s_county) = 0 then s_state end
+ order by sum(ss_net_profit) desc) as rank_within_parent
+ from
+ store_sales
+ ,date_dim d1
+ ,store
+ where
+ d1.d_month_seq between 1218 and 1218+11
+ and d1.d_date_sk = ss_sold_date_sk
+ and s_store_sk = ss_store_sk
+ and s_state in
+ ( select s_state
+ from (select s_state as s_state,
+ rank() over ( partition by s_state order by sum(ss_net_profit) desc) as ranking
+ from store_sales, store, date_dim
+ where d_month_seq between 1218 and 1218+11
+ and d_date_sk = ss_sold_date_sk
+ and s_store_sk = ss_store_sk
+ group by s_state
+ ) tmp1
+ where ranking <= 5
+ )
+ group by rollup(s_state,s_county)
+ order by
+ lochierarchy desc
+ ,case when lochierarchy = 0 then s_state end
+ ,rank_within_parent
+ limit 100;
+
+-- end query 1 in stream 0 using template query70.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query71.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query71.sql
new file mode 100644
index 0000000000..eee496fe8a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query71.sql
@@ -0,0 +1,40 @@
+-- start query 1 in stream 0 using template query71.tpl and seed 2031708268
+select i_brand_id brand_id, i_brand brand,t_hour,t_minute,
+ sum(ext_price) ext_price
+ from item, (select ws_ext_sales_price as ext_price,
+ ws_sold_date_sk as sold_date_sk,
+ ws_item_sk as sold_item_sk,
+ ws_sold_time_sk as time_sk
+ from web_sales,date_dim
+ where d_date_sk = ws_sold_date_sk
+ and d_moy=12
+ and d_year=2000
+ union all
+ select cs_ext_sales_price as ext_price,
+ cs_sold_date_sk as sold_date_sk,
+ cs_item_sk as sold_item_sk,
+ cs_sold_time_sk as time_sk
+ from catalog_sales,date_dim
+ where d_date_sk = cs_sold_date_sk
+ and d_moy=12
+ and d_year=2000
+ union all
+ select ss_ext_sales_price as ext_price,
+ ss_sold_date_sk as sold_date_sk,
+ ss_item_sk as sold_item_sk,
+ ss_sold_time_sk as time_sk
+ from store_sales,date_dim
+ where d_date_sk = ss_sold_date_sk
+ and d_moy=12
+ and d_year=2000
+ ) tmp,time_dim
+ where
+ sold_item_sk = i_item_sk
+ and i_manager_id=1
+ and time_sk = t_time_sk
+ and (t_meal_time = 'breakfast' or t_meal_time = 'dinner')
+ group by i_brand, i_brand_id,t_hour,t_minute
+ order by ext_price desc, i_brand_id
+ ;
+
+-- end query 1 in stream 0 using template query71.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query72.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query72.sql
new file mode 100644
index 0000000000..85db71ca1e
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query72.sql
@@ -0,0 +1,29 @@
+-- start query 1 in stream 0 using template query72.tpl and seed 2031708268
+select i_item_desc
+ ,w_warehouse_name
+ ,d1.d_week_seq
+ ,sum(case when p_promo_sk is null then 1 else 0 end) no_promo
+ ,sum(case when p_promo_sk is not null then 1 else 0 end) promo
+ ,count(*) total_cnt
+from catalog_sales
+join inventory on (cs_item_sk = inv_item_sk)
+join warehouse on (w_warehouse_sk=inv_warehouse_sk)
+join item on (i_item_sk = cs_item_sk)
+join customer_demographics on (cs_bill_cdemo_sk = cd_demo_sk)
+join household_demographics on (cs_bill_hdemo_sk = hd_demo_sk)
+join date_dim d1 on (cs_sold_date_sk = d1.d_date_sk)
+join date_dim d2 on (inv_date_sk = d2.d_date_sk)
+join date_dim d3 on (cs_ship_date_sk = d3.d_date_sk)
+left outer join promotion on (cs_promo_sk=p_promo_sk)
+left outer join catalog_returns on (cr_item_sk = cs_item_sk and cr_order_number = cs_order_number)
+where d1.d_week_seq = d2.d_week_seq
+ and inv_quantity_on_hand < cs_quantity
+ and d3.d_date > d1.d_date + INTERVAL(5) DAY
+ and hd_buy_potential = '1001-5000'
+ and d1.d_year = 2000
+ and cd_marital_status = 'D'
+group by i_item_desc,w_warehouse_name,d1.d_week_seq
+order by total_cnt desc, i_item_desc, w_warehouse_name, d_week_seq
+limit 100;
+
+-- end query 1 in stream 0 using template query72.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query73.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query73.sql
new file mode 100644
index 0000000000..2daa968d72
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query73.sql
@@ -0,0 +1,28 @@
+-- start query 1 in stream 0 using template query73.tpl and seed 1971067816
+select c_last_name
+ ,c_first_name
+ ,c_salutation
+ ,c_preferred_cust_flag
+ ,ss_ticket_number
+ ,cnt from
+ (select ss_ticket_number
+ ,ss_customer_sk
+ ,count(*) cnt
+ from store_sales,date_dim,store,household_demographics
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_store_sk = store.s_store_sk
+ and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+ and date_dim.d_dom between 1 and 2
+ and (household_demographics.hd_buy_potential = '>10000' or
+ household_demographics.hd_buy_potential = '5001-10000')
+ and household_demographics.hd_vehicle_count > 0
+ and case when household_demographics.hd_vehicle_count > 0 then
+ household_demographics.hd_dep_count/ household_demographics.hd_vehicle_count else null end > 1
+ and date_dim.d_year in (2000,2000+1,2000+2)
+ and store.s_county in ('Lea County','Furnas County','Pennington County','Bronx County')
+ group by ss_ticket_number,ss_customer_sk) dj,customer
+ where ss_customer_sk = c_customer_sk
+ and cnt between 1 and 5
+ order by cnt desc, c_last_name asc;
+
+-- end query 1 in stream 0 using template query73.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query74.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query74.sql
new file mode 100644
index 0000000000..d44235f5cd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query74.sql
@@ -0,0 +1,61 @@
+-- start query 1 in stream 0 using template query74.tpl and seed 1556717815
+with year_total as (
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,d_year as year
+ ,sum(ss_net_paid) year_total
+ ,'s' sale_type
+ from customer
+ ,store_sales
+ ,date_dim
+ where c_customer_sk = ss_customer_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_year in (1998,1998+1)
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,d_year
+ union all
+ select c_customer_id customer_id
+ ,c_first_name customer_first_name
+ ,c_last_name customer_last_name
+ ,d_year as year
+ ,sum(ws_net_paid) year_total
+ ,'w' sale_type
+ from customer
+ ,web_sales
+ ,date_dim
+ where c_customer_sk = ws_bill_customer_sk
+ and ws_sold_date_sk = d_date_sk
+ and d_year in (1998,1998+1)
+ group by c_customer_id
+ ,c_first_name
+ ,c_last_name
+ ,d_year
+ )
+ select
+ t_s_secyear.customer_id, t_s_secyear.customer_first_name, t_s_secyear.customer_last_name
+ from year_total t_s_firstyear
+ ,year_total t_s_secyear
+ ,year_total t_w_firstyear
+ ,year_total t_w_secyear
+ where t_s_secyear.customer_id = t_s_firstyear.customer_id
+ and t_s_firstyear.customer_id = t_w_secyear.customer_id
+ and t_s_firstyear.customer_id = t_w_firstyear.customer_id
+ and t_s_firstyear.sale_type = 's'
+ and t_w_firstyear.sale_type = 'w'
+ and t_s_secyear.sale_type = 's'
+ and t_w_secyear.sale_type = 'w'
+ and t_s_firstyear.year = 1998
+ and t_s_secyear.year = 1998+1
+ and t_w_firstyear.year = 1998
+ and t_w_secyear.year = 1998+1
+ and t_s_firstyear.year_total > 0
+ and t_w_firstyear.year_total > 0
+ and case when t_w_firstyear.year_total > 0 then t_w_secyear.year_total / t_w_firstyear.year_total else null end
+ > case when t_s_firstyear.year_total > 0 then t_s_secyear.year_total / t_s_firstyear.year_total else null end
+ order by 3,1,2
+limit 100;
+
+-- end query 1 in stream 0 using template query74.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query75.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query75.sql
new file mode 100644
index 0000000000..50b507e1b5
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query75.sql
@@ -0,0 +1,70 @@
+-- start query 1 in stream 0 using template query75.tpl and seed 1819994127
+WITH all_sales AS (
+ SELECT d_year
+ ,i_brand_id
+ ,i_class_id
+ ,i_category_id
+ ,i_manufact_id
+ ,SUM(sales_cnt) AS sales_cnt
+ ,SUM(sales_amt) AS sales_amt
+ FROM (SELECT d_year
+ ,i_brand_id
+ ,i_class_id
+ ,i_category_id
+ ,i_manufact_id
+ ,cs_quantity - COALESCE(cr_return_quantity,0) AS sales_cnt
+ ,cs_ext_sales_price - COALESCE(cr_return_amount,0.0) AS sales_amt
+ FROM catalog_sales JOIN item ON i_item_sk=cs_item_sk
+ JOIN date_dim ON d_date_sk=cs_sold_date_sk
+ LEFT JOIN catalog_returns ON (cs_order_number=cr_order_number
+ AND cs_item_sk=cr_item_sk)
+ WHERE i_category='Sports'
+ UNION
+ SELECT d_year
+ ,i_brand_id
+ ,i_class_id
+ ,i_category_id
+ ,i_manufact_id
+ ,ss_quantity - COALESCE(sr_return_quantity,0) AS sales_cnt
+ ,ss_ext_sales_price - COALESCE(sr_return_amt,0.0) AS sales_amt
+ FROM store_sales JOIN item ON i_item_sk=ss_item_sk
+ JOIN date_dim ON d_date_sk=ss_sold_date_sk
+ LEFT JOIN store_returns ON (ss_ticket_number=sr_ticket_number
+ AND ss_item_sk=sr_item_sk)
+ WHERE i_category='Sports'
+ UNION
+ SELECT d_year
+ ,i_brand_id
+ ,i_class_id
+ ,i_category_id
+ ,i_manufact_id
+ ,ws_quantity - COALESCE(wr_return_quantity,0) AS sales_cnt
+ ,ws_ext_sales_price - COALESCE(wr_return_amt,0.0) AS sales_amt
+ FROM web_sales JOIN item ON i_item_sk=ws_item_sk
+ JOIN date_dim ON d_date_sk=ws_sold_date_sk
+ LEFT JOIN web_returns ON (ws_order_number=wr_order_number
+ AND ws_item_sk=wr_item_sk)
+ WHERE i_category='Sports') sales_detail
+ GROUP BY d_year, i_brand_id, i_class_id, i_category_id, i_manufact_id)
+ SELECT prev_yr.d_year AS prev_year
+ ,curr_yr.d_year AS year
+ ,curr_yr.i_brand_id
+ ,curr_yr.i_class_id
+ ,curr_yr.i_category_id
+ ,curr_yr.i_manufact_id
+ ,prev_yr.sales_cnt AS prev_yr_cnt
+ ,curr_yr.sales_cnt AS curr_yr_cnt
+ ,curr_yr.sales_cnt-prev_yr.sales_cnt AS sales_cnt_diff
+ ,curr_yr.sales_amt-prev_yr.sales_amt AS sales_amt_diff
+ FROM all_sales curr_yr, all_sales prev_yr
+ WHERE curr_yr.i_brand_id=prev_yr.i_brand_id
+ AND curr_yr.i_class_id=prev_yr.i_class_id
+ AND curr_yr.i_category_id=prev_yr.i_category_id
+ AND curr_yr.i_manufact_id=prev_yr.i_manufact_id
+ AND curr_yr.d_year=2001
+ AND prev_yr.d_year=2001-1
+ AND CAST(curr_yr.sales_cnt AS DECIMAL(17,2))/CAST(prev_yr.sales_cnt AS DECIMAL(17,2))<0.9
+ ORDER BY sales_cnt_diff,sales_amt_diff
+ limit 100;
+
+-- end query 1 in stream 0 using template query75.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query76.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query76.sql
new file mode 100644
index 0000000000..eeb5d287c0
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query76.sql
@@ -0,0 +1,24 @@
+-- start query 1 in stream 0 using template query76.tpl and seed 2031708268
+select channel, col_name, d_year, d_qoy, i_category, COUNT(*) sales_cnt, SUM(ext_sales_price) sales_amt FROM (
+ SELECT 'store' as channel, 'ss_customer_sk' col_name, d_year, d_qoy, i_category, ss_ext_sales_price ext_sales_price
+ FROM store_sales, item, date_dim
+ WHERE ss_customer_sk IS NULL
+ AND ss_sold_date_sk=d_date_sk
+ AND ss_item_sk=i_item_sk
+ UNION ALL
+ SELECT 'web' as channel, 'ws_ship_addr_sk' col_name, d_year, d_qoy, i_category, ws_ext_sales_price ext_sales_price
+ FROM web_sales, item, date_dim
+ WHERE ws_ship_addr_sk IS NULL
+ AND ws_sold_date_sk=d_date_sk
+ AND ws_item_sk=i_item_sk
+ UNION ALL
+ SELECT 'catalog' as channel, 'cs_ship_mode_sk' col_name, d_year, d_qoy, i_category, cs_ext_sales_price ext_sales_price
+ FROM catalog_sales, item, date_dim
+ WHERE cs_ship_mode_sk IS NULL
+ AND cs_sold_date_sk=d_date_sk
+ AND cs_item_sk=i_item_sk) foo
+GROUP BY channel, col_name, d_year, d_qoy, i_category
+ORDER BY channel, col_name, d_year, d_qoy, i_category
+limit 100;
+
+-- end query 1 in stream 0 using template query76.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query77.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query77.sql
new file mode 100644
index 0000000000..ce875c85b0
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query77.sql
@@ -0,0 +1,108 @@
+-- start query 1 in stream 0 using template query77.tpl and seed 1819994127
+with ss as
+ (select s_store_sk,
+ sum(ss_ext_sales_price) as sales,
+ sum(ss_net_profit) as profit
+ from store_sales,
+ date_dim,
+ store
+ where ss_sold_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ and ss_store_sk = s_store_sk
+ group by s_store_sk)
+ ,
+ sr as
+ (select s_store_sk,
+ sum(sr_return_amt) as returns,
+ sum(sr_net_loss) as profit_loss
+ from store_returns,
+ date_dim,
+ store
+ where sr_returned_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ and sr_store_sk = s_store_sk
+ group by s_store_sk),
+ cs as
+ (select cs_call_center_sk,
+ sum(cs_ext_sales_price) as sales,
+ sum(cs_net_profit) as profit
+ from catalog_sales,
+ date_dim
+ where cs_sold_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ group by cs_call_center_sk
+ ),
+ cr as
+ (select cr_call_center_sk,
+ sum(cr_return_amount) as returns,
+ sum(cr_net_loss) as profit_loss
+ from catalog_returns,
+ date_dim
+ where cr_returned_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ group by cr_call_center_sk
+ ),
+ ws as
+ ( select wp_web_page_sk,
+ sum(ws_ext_sales_price) as sales,
+ sum(ws_net_profit) as profit
+ from web_sales,
+ date_dim,
+ web_page
+ where ws_sold_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ and ws_web_page_sk = wp_web_page_sk
+ group by wp_web_page_sk),
+ wr as
+ (select wp_web_page_sk,
+ sum(wr_return_amt) as returns,
+ sum(wr_net_loss) as profit_loss
+ from web_returns,
+ date_dim,
+ web_page
+ where wr_returned_date_sk = d_date_sk
+ and d_date between cast('2000-08-16' as date)
+ and (cast('2000-08-16' as date) + 30 days)
+ and wr_web_page_sk = wp_web_page_sk
+ group by wp_web_page_sk)
+ select channel
+ , id
+ , sum(sales) as sales
+ , sum(returns) as returns
+ , sum(profit) as profit
+ from
+ (select 'store channel' as channel
+ , ss.s_store_sk as id
+ , sales
+ , coalesce(returns, 0) as returns
+ , (profit - coalesce(profit_loss,0)) as profit
+ from ss left join sr
+ on ss.s_store_sk = sr.s_store_sk
+ union all
+ select 'catalog channel' as channel
+ , cs_call_center_sk as id
+ , sales
+ , returns
+ , (profit - profit_loss) as profit
+ from cs
+ , cr
+ union all
+ select 'web channel' as channel
+ , ws.wp_web_page_sk as id
+ , sales
+ , coalesce(returns, 0) returns
+ , (profit - coalesce(profit_loss,0)) as profit
+ from ws left join wr
+ on ws.wp_web_page_sk = wr.wp_web_page_sk
+ ) x
+ group by rollup (channel, id)
+ order by channel
+ ,id
+ limit 100;
+
+-- end query 1 in stream 0 using template query77.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query78.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query78.sql
new file mode 100644
index 0000000000..51edefc508
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query78.sql
@@ -0,0 +1,58 @@
+-- start query 1 in stream 0 using template query78.tpl and seed 1819994127
+with ws as
+ (select d_year AS ws_sold_year, ws_item_sk,
+ ws_bill_customer_sk ws_customer_sk,
+ sum(ws_quantity) ws_qty,
+ sum(ws_wholesale_cost) ws_wc,
+ sum(ws_sales_price) ws_sp
+ from web_sales
+ left join web_returns on wr_order_number=ws_order_number and ws_item_sk=wr_item_sk
+ join date_dim on ws_sold_date_sk = d_date_sk
+ where wr_order_number is null
+ group by d_year, ws_item_sk, ws_bill_customer_sk
+ ),
+cs as
+ (select d_year AS cs_sold_year, cs_item_sk,
+ cs_bill_customer_sk cs_customer_sk,
+ sum(cs_quantity) cs_qty,
+ sum(cs_wholesale_cost) cs_wc,
+ sum(cs_sales_price) cs_sp
+ from catalog_sales
+ left join catalog_returns on cr_order_number=cs_order_number and cs_item_sk=cr_item_sk
+ join date_dim on cs_sold_date_sk = d_date_sk
+ where cr_order_number is null
+ group by d_year, cs_item_sk, cs_bill_customer_sk
+ ),
+ss as
+ (select d_year AS ss_sold_year, ss_item_sk,
+ ss_customer_sk,
+ sum(ss_quantity) ss_qty,
+ sum(ss_wholesale_cost) ss_wc,
+ sum(ss_sales_price) ss_sp
+ from store_sales
+ left join store_returns on sr_ticket_number=ss_ticket_number and ss_item_sk=sr_item_sk
+ join date_dim on ss_sold_date_sk = d_date_sk
+ where sr_ticket_number is null
+ group by d_year, ss_item_sk, ss_customer_sk
+ )
+ select
+ss_customer_sk,
+round(ss_qty/(coalesce(ws_qty,0)+coalesce(cs_qty,0)),2) ratio,
+ss_qty store_qty, ss_wc store_wholesale_cost, ss_sp store_sales_price,
+coalesce(ws_qty,0)+coalesce(cs_qty,0) other_chan_qty,
+coalesce(ws_wc,0)+coalesce(cs_wc,0) other_chan_wholesale_cost,
+coalesce(ws_sp,0)+coalesce(cs_sp,0) other_chan_sales_price
+from ss
+left join ws on (ws_sold_year=ss_sold_year and ws_item_sk=ss_item_sk and ws_customer_sk=ss_customer_sk)
+left join cs on (cs_sold_year=ss_sold_year and cs_item_sk=ss_item_sk and cs_customer_sk=ss_customer_sk)
+where (coalesce(ws_qty,0)>0 or coalesce(cs_qty, 0)>0) and ss_sold_year=2001
+order by
+ ss_customer_sk,
+ ss_qty desc, ss_wc desc, ss_sp desc,
+ other_chan_qty,
+ other_chan_wholesale_cost,
+ other_chan_sales_price,
+ ratio
+limit 100;
+
+-- end query 1 in stream 0 using template query78.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query79.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query79.sql
new file mode 100644
index 0000000000..72ae60c616
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query79.sql
@@ -0,0 +1,23 @@
+-- start query 1 in stream 0 using template query79.tpl and seed 2031708268
+select
+ c_last_name,c_first_name,substr(s_city,1,30),ss_ticket_number,amt,profit
+ from
+ (select ss_ticket_number
+ ,ss_customer_sk
+ ,store.s_city
+ ,sum(ss_coupon_amt) amt
+ ,sum(ss_net_profit) profit
+ from store_sales,date_dim,store,household_demographics
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_store_sk = store.s_store_sk
+ and store_sales.ss_hdemo_sk = household_demographics.hd_demo_sk
+ and (household_demographics.hd_dep_count = 0 or household_demographics.hd_vehicle_count > 3)
+ and date_dim.d_dow = 1
+ and date_dim.d_year in (1998,1998+1,1998+2)
+ and store.s_number_employees between 200 and 295
+ group by ss_ticket_number,ss_customer_sk,ss_addr_sk,store.s_city) ms,customer
+ where ss_customer_sk = c_customer_sk
+ order by c_last_name,c_first_name,substr(s_city,1,30), profit
+limit 100;
+
+-- end query 1 in stream 0 using template query79.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query8.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query8.sql
new file mode 100644
index 0000000000..6faf5d819d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query8.sql
@@ -0,0 +1,108 @@
+-- start query 1 in stream 0 using template query8.tpl and seed 1766988859
+select s_store_name
+ ,sum(ss_net_profit)
+ from store_sales
+ ,date_dim
+ ,store,
+ (select ca_zip
+ from (
+ SELECT substr(ca_zip,1,5) ca_zip
+ FROM customer_address
+ WHERE substr(ca_zip,1,5) IN (
+ '47602','16704','35863','28577','83910','36201',
+ '58412','48162','28055','41419','80332',
+ '38607','77817','24891','16226','18410',
+ '21231','59345','13918','51089','20317',
+ '17167','54585','67881','78366','47770',
+ '18360','51717','73108','14440','21800',
+ '89338','45859','65501','34948','25973',
+ '73219','25333','17291','10374','18829',
+ '60736','82620','41351','52094','19326',
+ '25214','54207','40936','21814','79077',
+ '25178','75742','77454','30621','89193',
+ '27369','41232','48567','83041','71948',
+ '37119','68341','14073','16891','62878',
+ '49130','19833','24286','27700','40979',
+ '50412','81504','94835','84844','71954',
+ '39503','57649','18434','24987','12350',
+ '86379','27413','44529','98569','16515',
+ '27287','24255','21094','16005','56436',
+ '91110','68293','56455','54558','10298',
+ '83647','32754','27052','51766','19444',
+ '13869','45645','94791','57631','20712',
+ '37788','41807','46507','21727','71836',
+ '81070','50632','88086','63991','20244',
+ '31655','51782','29818','63792','68605',
+ '94898','36430','57025','20601','82080',
+ '33869','22728','35834','29086','92645',
+ '98584','98072','11652','78093','57553',
+ '43830','71144','53565','18700','90209',
+ '71256','38353','54364','28571','96560',
+ '57839','56355','50679','45266','84680',
+ '34306','34972','48530','30106','15371',
+ '92380','84247','92292','68852','13338',
+ '34594','82602','70073','98069','85066',
+ '47289','11686','98862','26217','47529',
+ '63294','51793','35926','24227','14196',
+ '24594','32489','99060','49472','43432',
+ '49211','14312','88137','47369','56877',
+ '20534','81755','15794','12318','21060',
+ '73134','41255','63073','81003','73873',
+ '66057','51184','51195','45676','92696',
+ '70450','90669','98338','25264','38919',
+ '59226','58581','60298','17895','19489',
+ '52301','80846','95464','68770','51634',
+ '19988','18367','18421','11618','67975',
+ '25494','41352','95430','15734','62585',
+ '97173','33773','10425','75675','53535',
+ '17879','41967','12197','67998','79658',
+ '59130','72592','14851','43933','68101',
+ '50636','25717','71286','24660','58058',
+ '72991','95042','15543','33122','69280',
+ '11912','59386','27642','65177','17672',
+ '33467','64592','36335','54010','18767',
+ '63193','42361','49254','33113','33159',
+ '36479','59080','11855','81963','31016',
+ '49140','29392','41836','32958','53163',
+ '13844','73146','23952','65148','93498',
+ '14530','46131','58454','13376','13378',
+ '83986','12320','17193','59852','46081',
+ '98533','52389','13086','68843','31013',
+ '13261','60560','13443','45533','83583',
+ '11489','58218','19753','22911','25115',
+ '86709','27156','32669','13123','51933',
+ '39214','41331','66943','14155','69998',
+ '49101','70070','35076','14242','73021',
+ '59494','15782','29752','37914','74686',
+ '83086','34473','15751','81084','49230',
+ '91894','60624','17819','28810','63180',
+ '56224','39459','55233','75752','43639',
+ '55349','86057','62361','50788','31830',
+ '58062','18218','85761','60083','45484',
+ '21204','90229','70041','41162','35390',
+ '16364','39500','68908','26689','52868',
+ '81335','40146','11340','61527','61794',
+ '71997','30415','59004','29450','58117',
+ '69952','33562','83833','27385','61860',
+ '96435','48333','23065','32961','84919',
+ '61997','99132','22815','56600','68730',
+ '48017','95694','32919','88217','27116',
+ '28239','58032','18884','16791','21343',
+ '97462','18569','75660','15475')
+ intersect
+ select ca_zip
+ from (SELECT substr(ca_zip,1,5) ca_zip,count(*) cnt
+ FROM customer_address, customer
+ WHERE ca_address_sk = c_current_addr_sk and
+ c_preferred_cust_flag='Y'
+ group by ca_zip
+ having count(*) > 10)A1)A2) V1
+ where ss_store_sk = s_store_sk
+ and ss_sold_date_sk = d_date_sk
+ and d_qoy = 2 and d_year = 1998
+ and (substr(s_zip,1,2) = substr(V1.ca_zip,1,2))
+ group by s_store_name
+ order by s_store_name
+ limit 100;
+
+-- end query 1 in stream 0 using template query8.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query80.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query80.sql
new file mode 100644
index 0000000000..522f9e0c3c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query80.sql
@@ -0,0 +1,96 @@
+-- start query 1 in stream 0 using template query80.tpl and seed 1819994127
+with ssr as
+ (select s_store_id as store_id,
+ sum(ss_ext_sales_price) as sales,
+ sum(coalesce(sr_return_amt, 0)) as returns,
+ sum(ss_net_profit - coalesce(sr_net_loss, 0)) as profit
+ from store_sales left outer join store_returns on
+ (ss_item_sk = sr_item_sk and ss_ticket_number = sr_ticket_number),
+ date_dim,
+ store,
+ item,
+ promotion
+ where ss_sold_date_sk = d_date_sk
+ and d_date between cast('2002-08-06' as date)
+ and (cast('2002-08-06' as date) + 30 days)
+ and ss_store_sk = s_store_sk
+ and ss_item_sk = i_item_sk
+ and i_current_price > 50
+ and ss_promo_sk = p_promo_sk
+ and p_channel_tv = 'N'
+ group by s_store_id)
+ ,
+ csr as
+ (select cp_catalog_page_id as catalog_page_id,
+ sum(cs_ext_sales_price) as sales,
+ sum(coalesce(cr_return_amount, 0)) as returns,
+ sum(cs_net_profit - coalesce(cr_net_loss, 0)) as profit
+ from catalog_sales left outer join catalog_returns on
+ (cs_item_sk = cr_item_sk and cs_order_number = cr_order_number),
+ date_dim,
+ catalog_page,
+ item,
+ promotion
+ where cs_sold_date_sk = d_date_sk
+ and d_date between cast('2002-08-06' as date)
+ and (cast('2002-08-06' as date) + 30 days)
+ and cs_catalog_page_sk = cp_catalog_page_sk
+ and cs_item_sk = i_item_sk
+ and i_current_price > 50
+ and cs_promo_sk = p_promo_sk
+ and p_channel_tv = 'N'
+group by cp_catalog_page_id)
+ ,
+ wsr as
+ (select web_site_id,
+ sum(ws_ext_sales_price) as sales,
+ sum(coalesce(wr_return_amt, 0)) as returns,
+ sum(ws_net_profit - coalesce(wr_net_loss, 0)) as profit
+ from web_sales left outer join web_returns on
+ (ws_item_sk = wr_item_sk and ws_order_number = wr_order_number),
+ date_dim,
+ web_site,
+ item,
+ promotion
+ where ws_sold_date_sk = d_date_sk
+ and d_date between cast('2002-08-06' as date)
+ and (cast('2002-08-06' as date) + 30 days)
+ and ws_web_site_sk = web_site_sk
+ and ws_item_sk = i_item_sk
+ and i_current_price > 50
+ and ws_promo_sk = p_promo_sk
+ and p_channel_tv = 'N'
+group by web_site_id)
+ select channel
+ , id
+ , sum(sales) as sales
+ , sum(returns) as returns
+ , sum(profit) as profit
+ from
+ (select 'store channel' as channel
+ , 'store' || store_id as id
+ , sales
+ , returns
+ , profit
+ from ssr
+ union all
+ select 'catalog channel' as channel
+ , 'catalog_page' || catalog_page_id as id
+ , sales
+ , returns
+ , profit
+ from csr
+ union all
+ select 'web channel' as channel
+ , 'web_site' || web_site_id as id
+ , sales
+ , returns
+ , profit
+ from wsr
+ ) x
+ group by rollup (channel, id)
+ order by channel
+ ,id
+ limit 100;
+
+-- end query 1 in stream 0 using template query80.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query81.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query81.sql
new file mode 100644
index 0000000000..3483ab7c6d
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query81.sql
@@ -0,0 +1,31 @@
+-- start query 1 in stream 0 using template query81.tpl and seed 1819994127
+with customer_total_return as
+ (select cr_returning_customer_sk as ctr_customer_sk
+ ,ca_state as ctr_state,
+ sum(cr_return_amt_inc_tax) as ctr_total_return
+ from catalog_returns
+ ,date_dim
+ ,customer_address
+ where cr_returned_date_sk = d_date_sk
+ and d_year =1998
+ and cr_returning_addr_sk = ca_address_sk
+ group by cr_returning_customer_sk
+ ,ca_state )
+ select c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name
+ ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset
+ ,ca_location_type,ctr_total_return
+ from customer_total_return ctr1
+ ,customer_address
+ ,customer
+ where ctr1.ctr_total_return > (select avg(ctr_total_return)*1.2
+ from customer_total_return ctr2
+ where ctr1.ctr_state = ctr2.ctr_state)
+ and ca_address_sk = c_current_addr_sk
+ and ca_state = 'TX'
+ and ctr1.ctr_customer_sk = c_customer_sk
+ order by c_customer_id,c_salutation,c_first_name,c_last_name,ca_street_number,ca_street_name
+ ,ca_street_type,ca_suite_number,ca_city,ca_county,ca_state,ca_zip,ca_country,ca_gmt_offset
+ ,ca_location_type,ctr_total_return
+ limit 100;
+
+-- end query 1 in stream 0 using template query81.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query82.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query82.sql
new file mode 100644
index 0000000000..fd83a7833c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query82.sql
@@ -0,0 +1,17 @@
+-- start query 1 in stream 0 using template query82.tpl and seed 55585014
+select i_item_id
+ ,i_item_desc
+ ,i_current_price
+ from item, inventory, date_dim, store_sales
+ where i_current_price between 49 and 49+30
+ and inv_item_sk = i_item_sk
+ and d_date_sk=inv_date_sk
+ and d_date between cast('2001-01-28' as date) and (cast('2001-01-28' as date) + 60 days)
+ and i_manufact_id in (80,675,292,17)
+ and inv_quantity_on_hand between 100 and 500
+ and ss_item_sk = i_item_sk
+ group by i_item_id,i_item_desc,i_current_price
+ order by i_item_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query82.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query83.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query83.sql
new file mode 100644
index 0000000000..49d5bc199b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query83.sql
@@ -0,0 +1,67 @@
+-- start query 1 in stream 0 using template query83.tpl and seed 1930872976
+with sr_items as
+ (select i_item_id item_id,
+ sum(sr_return_quantity) sr_item_qty
+ from store_returns,
+ item,
+ date_dim
+ where sr_item_sk = i_item_sk
+ and d_date in
+ (select d_date
+ from date_dim
+ where d_week_seq in
+ (select d_week_seq
+ from date_dim
+ where d_date in ('2000-06-17','2000-08-22','2000-11-17')))
+ and sr_returned_date_sk = d_date_sk
+ group by i_item_id),
+ cr_items as
+ (select i_item_id item_id,
+ sum(cr_return_quantity) cr_item_qty
+ from catalog_returns,
+ item,
+ date_dim
+ where cr_item_sk = i_item_sk
+ and d_date in
+ (select d_date
+ from date_dim
+ where d_week_seq in
+ (select d_week_seq
+ from date_dim
+ where d_date in ('2000-06-17','2000-08-22','2000-11-17')))
+ and cr_returned_date_sk = d_date_sk
+ group by i_item_id),
+ wr_items as
+ (select i_item_id item_id,
+ sum(wr_return_quantity) wr_item_qty
+ from web_returns,
+ item,
+ date_dim
+ where wr_item_sk = i_item_sk
+ and d_date in
+ (select d_date
+ from date_dim
+ where d_week_seq in
+ (select d_week_seq
+ from date_dim
+ where d_date in ('2000-06-17','2000-08-22','2000-11-17')))
+ and wr_returned_date_sk = d_date_sk
+ group by i_item_id)
+ select sr_items.item_id
+ ,sr_item_qty
+ ,sr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 sr_dev
+ ,cr_item_qty
+ ,cr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 cr_dev
+ ,wr_item_qty
+ ,wr_item_qty/(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 * 100 wr_dev
+ ,(sr_item_qty+cr_item_qty+wr_item_qty)/3.0 average
+ from sr_items
+ ,cr_items
+ ,wr_items
+ where sr_items.item_id=cr_items.item_id
+ and sr_items.item_id=wr_items.item_id
+ order by sr_items.item_id
+ ,sr_item_qty
+ limit 100;
+
+-- end query 1 in stream 0 using template query83.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query84.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query84.sql
new file mode 100644
index 0000000000..ba83c5a18e
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query84.sql
@@ -0,0 +1,21 @@
+-- start query 1 in stream 0 using template query84.tpl and seed 1819994127
+select c_customer_id as customer_id
+ , coalesce(c_last_name,'') || ', ' || coalesce(c_first_name,'') as customername
+ from customer
+ ,customer_address
+ ,customer_demographics
+ ,household_demographics
+ ,income_band
+ ,store_returns
+ where ca_city = 'Hopewell'
+ and c_current_addr_sk = ca_address_sk
+ and ib_lower_bound >= 37855
+ and ib_upper_bound <= 37855 + 50000
+ and ib_income_band_sk = hd_income_band_sk
+ and cd_demo_sk = c_current_cdemo_sk
+ and hd_demo_sk = c_current_hdemo_sk
+ and sr_cdemo_sk = cd_demo_sk
+ order by c_customer_id
+ limit 100;
+
+-- end query 1 in stream 0 using template query84.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query85.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query85.sql
new file mode 100644
index 0000000000..dc7932a902
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query85.sql
@@ -0,0 +1,84 @@
+-- start query 1 in stream 0 using template query85.tpl and seed 622697896
+select substr(r_reason_desc,1,20)
+ ,avg(ws_quantity)
+ ,avg(wr_refunded_cash)
+ ,avg(wr_fee)
+ from web_sales, web_returns, web_page, customer_demographics cd1,
+ customer_demographics cd2, customer_address, date_dim, reason
+ where ws_web_page_sk = wp_web_page_sk
+ and ws_item_sk = wr_item_sk
+ and ws_order_number = wr_order_number
+ and ws_sold_date_sk = d_date_sk and d_year = 2001
+ and cd1.cd_demo_sk = wr_refunded_cdemo_sk
+ and cd2.cd_demo_sk = wr_returning_cdemo_sk
+ and ca_address_sk = wr_refunded_addr_sk
+ and r_reason_sk = wr_reason_sk
+ and
+ (
+ (
+ cd1.cd_marital_status = 'M'
+ and
+ cd1.cd_marital_status = cd2.cd_marital_status
+ and
+ cd1.cd_education_status = '4 yr Degree'
+ and
+ cd1.cd_education_status = cd2.cd_education_status
+ and
+ ws_sales_price between 100.00 and 150.00
+ )
+ or
+ (
+ cd1.cd_marital_status = 'S'
+ and
+ cd1.cd_marital_status = cd2.cd_marital_status
+ and
+ cd1.cd_education_status = 'College'
+ and
+ cd1.cd_education_status = cd2.cd_education_status
+ and
+ ws_sales_price between 50.00 and 100.00
+ )
+ or
+ (
+ cd1.cd_marital_status = 'D'
+ and
+ cd1.cd_marital_status = cd2.cd_marital_status
+ and
+ cd1.cd_education_status = 'Secondary'
+ and
+ cd1.cd_education_status = cd2.cd_education_status
+ and
+ ws_sales_price between 150.00 and 200.00
+ )
+ )
+ and
+ (
+ (
+ ca_country = 'United States'
+ and
+ ca_state in ('TX', 'VA', 'CA')
+ and ws_net_profit between 100 and 200
+ )
+ or
+ (
+ ca_country = 'United States'
+ and
+ ca_state in ('AR', 'NE', 'MO')
+ and ws_net_profit between 150 and 300
+ )
+ or
+ (
+ ca_country = 'United States'
+ and
+ ca_state in ('IA', 'MS', 'WA')
+ and ws_net_profit between 50 and 250
+ )
+ )
+group by r_reason_desc
+order by substr(r_reason_desc,1,20)
+ ,avg(ws_quantity)
+ ,avg(wr_refunded_cash)
+ ,avg(wr_fee)
+limit 100;
+
+-- end query 1 in stream 0 using template query85.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query86.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query86.sql
new file mode 100644
index 0000000000..9b65cbda86
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query86.sql
@@ -0,0 +1,26 @@
+-- start query 1 in stream 0 using template query86.tpl and seed 1819994127
+select
+ sum(ws_net_paid) as total_sum
+ ,i_category
+ ,i_class
+ ,grouping(i_category)+grouping(i_class) as lochierarchy
+ ,rank() over (
+ partition by grouping(i_category)+grouping(i_class),
+ case when grouping(i_class) = 0 then i_category end
+ order by sum(ws_net_paid) desc) as rank_within_parent
+ from
+ web_sales
+ ,date_dim d1
+ ,item
+ where
+ d1.d_month_seq between 1215 and 1215+11
+ and d1.d_date_sk = ws_sold_date_sk
+ and i_item_sk = ws_item_sk
+ group by rollup(i_category,i_class)
+ order by
+ lochierarchy desc,
+ case when lochierarchy = 0 then i_category end,
+ rank_within_parent
+ limit 100;
+
+-- end query 1 in stream 0 using template query86.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query87.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query87.sql
new file mode 100644
index 0000000000..161e46443b
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query87.sql
@@ -0,0 +1,23 @@
+-- start query 1 in stream 0 using template query87.tpl and seed 1819994127
+select count(*)
+from ((select distinct c_last_name, c_first_name, d_date
+ from store_sales, date_dim, customer
+ where store_sales.ss_sold_date_sk = date_dim.d_date_sk
+ and store_sales.ss_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1221 and 1221+11)
+ except
+ (select distinct c_last_name, c_first_name, d_date
+ from catalog_sales, date_dim, customer
+ where catalog_sales.cs_sold_date_sk = date_dim.d_date_sk
+ and catalog_sales.cs_bill_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1221 and 1221+11)
+ except
+ (select distinct c_last_name, c_first_name, d_date
+ from web_sales, date_dim, customer
+ where web_sales.ws_sold_date_sk = date_dim.d_date_sk
+ and web_sales.ws_bill_customer_sk = customer.c_customer_sk
+ and d_month_seq between 1221 and 1221+11)
+) cool_cust
+;
+
+-- end query 1 in stream 0 using template query87.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query88.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query88.sql
new file mode 100644
index 0000000000..895fff5b78
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query88.sql
@@ -0,0 +1,94 @@
+-- start query 1 in stream 0 using template query88.tpl and seed 318176889
+select *
+from
+ (select count(*) h8_30_to_9
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 8
+ and time_dim.t_minute >= 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s1,
+ (select count(*) h9_to_9_30
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 9
+ and time_dim.t_minute < 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s2,
+ (select count(*) h9_30_to_10
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 9
+ and time_dim.t_minute >= 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s3,
+ (select count(*) h10_to_10_30
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 10
+ and time_dim.t_minute < 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s4,
+ (select count(*) h10_30_to_11
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 10
+ and time_dim.t_minute >= 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s5,
+ (select count(*) h11_to_11_30
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 11
+ and time_dim.t_minute < 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s6,
+ (select count(*) h11_30_to_12
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 11
+ and time_dim.t_minute >= 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s7,
+ (select count(*) h12_to_12_30
+ from store_sales, household_demographics , time_dim, store
+ where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 12
+ and time_dim.t_minute < 30
+ and ((household_demographics.hd_dep_count = 2 and household_demographics.hd_vehicle_count<=2+2) or
+ (household_demographics.hd_dep_count = 4 and household_demographics.hd_vehicle_count<=4+2) or
+ (household_demographics.hd_dep_count = 3 and household_demographics.hd_vehicle_count<=3+2))
+ and store.s_store_name = 'ese') s8
+;
+
+-- end query 1 in stream 0 using template query88.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query89.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query89.sql
new file mode 100644
index 0000000000..3a275d4e04
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query89.sql
@@ -0,0 +1,28 @@
+-- start query 1 in stream 0 using template query89.tpl and seed 1719819282
+select *
+from(
+select i_category, i_class, i_brand,
+ s_store_name, s_company_name,
+ d_moy,
+ sum(ss_sales_price) sum_sales,
+ avg(sum(ss_sales_price)) over
+ (partition by i_category, i_brand, s_store_name, s_company_name)
+ avg_monthly_sales
+from item, store_sales, date_dim, store
+where ss_item_sk = i_item_sk and
+ ss_sold_date_sk = d_date_sk and
+ ss_store_sk = s_store_sk and
+ d_year in (2000) and
+ ((i_category in ('Home','Music','Books') and
+ i_class in ('glassware','classical','fiction')
+ )
+ or (i_category in ('Jewelry','Sports','Women') and
+ i_class in ('semi-precious','baseball','dresses')
+ ))
+group by i_category, i_class, i_brand,
+ s_store_name, s_company_name, d_moy) tmp1
+where case when (avg_monthly_sales <> 0) then (abs(sum_sales - avg_monthly_sales) / avg_monthly_sales) else null end > 0.1
+order by sum_sales - avg_monthly_sales, s_store_name
+limit 100;
+
+-- end query 1 in stream 0 using template query89.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query9.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query9.sql
new file mode 100644
index 0000000000..059b9c5fbb
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query9.sql
@@ -0,0 +1,51 @@
+-- start query 1 in stream 0 using template query9.tpl and seed 1490436826
+select case when (select count(*)
+ from store_sales
+ where ss_quantity between 1 and 20) > 98972190
+ then (select avg(ss_ext_discount_amt)
+ from store_sales
+ where ss_quantity between 1 and 20)
+ else (select avg(ss_net_profit)
+ from store_sales
+ where ss_quantity between 1 and 20) end bucket1 ,
+ case when (select count(*)
+ from store_sales
+ where ss_quantity between 21 and 40) > 160856845
+ then (select avg(ss_ext_discount_amt)
+ from store_sales
+ where ss_quantity between 21 and 40)
+ else (select avg(ss_net_profit)
+ from store_sales
+ where ss_quantity between 21 and 40) end bucket2,
+ case when (select count(*)
+ from store_sales
+ where ss_quantity between 41 and 60) > 12733327
+ then (select avg(ss_ext_discount_amt)
+ from store_sales
+ where ss_quantity between 41 and 60)
+ else (select avg(ss_net_profit)
+ from store_sales
+ where ss_quantity between 41 and 60) end bucket3,
+ case when (select count(*)
+ from store_sales
+ where ss_quantity between 61 and 80) > 96251173
+ then (select avg(ss_ext_discount_amt)
+ from store_sales
+ where ss_quantity between 61 and 80)
+ else (select avg(ss_net_profit)
+ from store_sales
+ where ss_quantity between 61 and 80) end bucket4,
+ case when (select count(*)
+ from store_sales
+ where ss_quantity between 81 and 100) > 80049606
+ then (select avg(ss_ext_discount_amt)
+ from store_sales
+ where ss_quantity between 81 and 100)
+ else (select avg(ss_net_profit)
+ from store_sales
+ where ss_quantity between 81 and 100) end bucket5
+from reason
+where r_reason_sk = 1
+;
+
+-- end query 1 in stream 0 using template query9.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query90.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query90.sql
new file mode 100644
index 0000000000..366f07068c
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query90.sql
@@ -0,0 +1,22 @@
+-- start query 1 in stream 0 using template query90.tpl and seed 2031708268
+select cast(amc as decimal(15,4))/cast(pmc as decimal(15,4)) am_pm_ratio
+ from ( select count(*) amc
+ from web_sales, household_demographics , time_dim, web_page
+ where ws_sold_time_sk = time_dim.t_time_sk
+ and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
+ and ws_web_page_sk = web_page.wp_web_page_sk
+ and time_dim.t_hour between 9 and 9+1
+ and household_demographics.hd_dep_count = 3
+ and web_page.wp_char_count between 5000 and 5200) at,
+ ( select count(*) pmc
+ from web_sales, household_demographics , time_dim, web_page
+ where ws_sold_time_sk = time_dim.t_time_sk
+ and ws_ship_hdemo_sk = household_demographics.hd_demo_sk
+ and ws_web_page_sk = web_page.wp_web_page_sk
+ and time_dim.t_hour between 16 and 16+1
+ and household_demographics.hd_dep_count = 3
+ and web_page.wp_char_count between 5000 and 5200) pt
+ order by am_pm_ratio
+ limit 100;
+
+-- end query 1 in stream 0 using template query90.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query91.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query91.sql
new file mode 100644
index 0000000000..057c76ba82
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query91.sql
@@ -0,0 +1,31 @@
+-- start query 1 in stream 0 using template query91.tpl and seed 1930872976
+select
+ cc_call_center_id Call_Center,
+ cc_name Call_Center_Name,
+ cc_manager Manager,
+ sum(cr_net_loss) Returns_Loss
+from
+ call_center,
+ catalog_returns,
+ date_dim,
+ customer,
+ customer_address,
+ customer_demographics,
+ household_demographics
+where
+ cr_call_center_sk = cc_call_center_sk
+and cr_returned_date_sk = d_date_sk
+and cr_returning_customer_sk= c_customer_sk
+and cd_demo_sk = c_current_cdemo_sk
+and hd_demo_sk = c_current_hdemo_sk
+and ca_address_sk = c_current_addr_sk
+and d_year = 2000
+and d_moy = 12
+and ( (cd_marital_status = 'M' and cd_education_status = 'Unknown')
+ or(cd_marital_status = 'W' and cd_education_status = 'Advanced Degree'))
+and hd_buy_potential like 'Unknown%'
+and ca_gmt_offset = -7
+group by cc_call_center_id,cc_name,cc_manager,cd_marital_status,cd_education_status
+order by sum(cr_net_loss) desc;
+
+-- end query 1 in stream 0 using template query91.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query92.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query92.sql
new file mode 100644
index 0000000000..3f83e0ea76
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query92.sql
@@ -0,0 +1,30 @@
+-- start query 1 in stream 0 using template query92.tpl and seed 2031708268
+select
+ sum(ws_ext_discount_amt) as `Excess Discount Amount`
+from
+ web_sales
+ ,item
+ ,date_dim
+where
+i_manufact_id = 356
+and i_item_sk = ws_item_sk
+and d_date between '2001-03-12' and
+ (cast('2001-03-12' as date) + 90 days)
+and d_date_sk = ws_sold_date_sk
+and ws_ext_discount_amt
+ > (
+ SELECT
+ 1.3 * avg(ws_ext_discount_amt)
+ FROM
+ web_sales
+ ,date_dim
+ WHERE
+ ws_item_sk = i_item_sk
+ and d_date between '2001-03-12' and
+ (cast('2001-03-12' as date) + 90 days)
+ and d_date_sk = ws_sold_date_sk
+ )
+order by sum(ws_ext_discount_amt)
+limit 100;
+
+-- end query 1 in stream 0 using template query92.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query93.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query93.sql
new file mode 100644
index 0000000000..ed0b427df6
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query93.sql
@@ -0,0 +1,18 @@
+-- start query 1 in stream 0 using template query93.tpl and seed 1200409435
+select ss_customer_sk
+ ,sum(act_sales) sumsales
+ from (select ss_item_sk
+ ,ss_ticket_number
+ ,ss_customer_sk
+ ,case when sr_return_quantity is not null then (ss_quantity-sr_return_quantity)*ss_sales_price
+ else (ss_quantity*ss_sales_price) end act_sales
+ from store_sales left outer join store_returns on (sr_item_sk = ss_item_sk
+ and sr_ticket_number = ss_ticket_number)
+ ,reason
+ where sr_reason_sk = r_reason_sk
+ and r_reason_desc = 'reason 66') t
+ group by ss_customer_sk
+ order by sumsales, ss_customer_sk
+limit 100;
+
+-- end query 1 in stream 0 using template query93.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query94.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query94.sql
new file mode 100644
index 0000000000..76783ba71a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query94.sql
@@ -0,0 +1,29 @@
+-- start query 1 in stream 0 using template query94.tpl and seed 2031708268
+select
+ count(distinct ws_order_number) as `order count`
+ ,sum(ws_ext_ship_cost) as `total shipping cost`
+ ,sum(ws_net_profit) as `total net profit`
+from
+ web_sales ws1
+ ,date_dim
+ ,customer_address
+ ,web_site
+where
+ d_date between '1999-4-01' and
+ (cast('1999-4-01' as date) + 60 days)
+and ws1.ws_ship_date_sk = d_date_sk
+and ws1.ws_ship_addr_sk = ca_address_sk
+and ca_state = 'NE'
+and ws1.ws_web_site_sk = web_site_sk
+and web_company_name = 'pri'
+and exists (select *
+ from web_sales ws2
+ where ws1.ws_order_number = ws2.ws_order_number
+ and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk)
+and not exists(select *
+ from web_returns wr1
+ where ws1.ws_order_number = wr1.wr_order_number)
+order by count(distinct ws_order_number)
+limit 100;
+
+-- end query 1 in stream 0 using template query94.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query95.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query95.sql
new file mode 100644
index 0000000000..e8e9063fbd
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query95.sql
@@ -0,0 +1,32 @@
+-- start query 1 in stream 0 using template query95.tpl and seed 2031708268
+with ws_wh as
+(select ws1.ws_order_number,ws1.ws_warehouse_sk wh1,ws2.ws_warehouse_sk wh2
+ from web_sales ws1,web_sales ws2
+ where ws1.ws_order_number = ws2.ws_order_number
+ and ws1.ws_warehouse_sk <> ws2.ws_warehouse_sk)
+ select
+ count(distinct ws_order_number) as `order count`
+ ,sum(ws_ext_ship_cost) as `total shipping cost`
+ ,sum(ws_net_profit) as `total net profit`
+from
+ web_sales ws1
+ ,date_dim
+ ,customer_address
+ ,web_site
+where
+ d_date between '2002-4-01' and
+ (cast('2002-4-01' as date) + 60 days)
+and ws1.ws_ship_date_sk = d_date_sk
+and ws1.ws_ship_addr_sk = ca_address_sk
+and ca_state = 'AL'
+and ws1.ws_web_site_sk = web_site_sk
+and web_company_name = 'pri'
+and ws1.ws_order_number in (select ws_order_number
+ from ws_wh)
+and ws1.ws_order_number in (select wr_order_number
+ from web_returns,ws_wh
+ where wr_order_number = ws_wh.ws_order_number)
+order by count(distinct ws_order_number)
+limit 100;
+
+-- end query 1 in stream 0 using template query95.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query96.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query96.sql
new file mode 100644
index 0000000000..90be5df590
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query96.sql
@@ -0,0 +1,16 @@
+-- start query 1 in stream 0 using template query96.tpl and seed 1819994127
+select count(*)
+from store_sales
+ ,household_demographics
+ ,time_dim, store
+where ss_sold_time_sk = time_dim.t_time_sk
+ and ss_hdemo_sk = household_demographics.hd_demo_sk
+ and ss_store_sk = s_store_sk
+ and time_dim.t_hour = 16
+ and time_dim.t_minute >= 30
+ and household_demographics.hd_dep_count = 6
+ and store.s_store_name = 'ese'
+order by count(*)
+limit 100;
+
+-- end query 1 in stream 0 using template query96.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query97.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query97.sql
new file mode 100644
index 0000000000..a063214cff
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query97.sql
@@ -0,0 +1,25 @@
+-- start query 1 in stream 0 using template query97.tpl and seed 1819994127
+with ssci as (
+select ss_customer_sk customer_sk
+ ,ss_item_sk item_sk
+from store_sales,date_dim
+where ss_sold_date_sk = d_date_sk
+ and d_month_seq between 1190 and 1190 + 11
+group by ss_customer_sk
+ ,ss_item_sk),
+csci as(
+ select cs_bill_customer_sk customer_sk
+ ,cs_item_sk item_sk
+from catalog_sales,date_dim
+where cs_sold_date_sk = d_date_sk
+ and d_month_seq between 1190 and 1190 + 11
+group by cs_bill_customer_sk
+ ,cs_item_sk)
+ select sum(case when ssci.customer_sk is not null and csci.customer_sk is null then 1 else 0 end) store_only
+ ,sum(case when ssci.customer_sk is null and csci.customer_sk is not null then 1 else 0 end) catalog_only
+ ,sum(case when ssci.customer_sk is not null and csci.customer_sk is not null then 1 else 0 end) store_and_catalog
+from ssci full outer join csci on (ssci.customer_sk=csci.customer_sk
+ and ssci.item_sk = csci.item_sk)
+limit 100;
+
+-- end query 1 in stream 0 using template query97.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query98.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query98.sql
new file mode 100644
index 0000000000..e167dd989a
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query98.sql
@@ -0,0 +1,33 @@
+-- start query 1 in stream 0 using template query98.tpl and seed 345591136
+select i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+ ,sum(ss_ext_sales_price) as itemrevenue
+ ,sum(ss_ext_sales_price)*100/sum(sum(ss_ext_sales_price)) over
+ (partition by i_class) as revenueratio
+from
+ store_sales
+ ,item
+ ,date_dim
+where
+ ss_item_sk = i_item_sk
+ and i_category in ('Home', 'Sports', 'Men')
+ and ss_sold_date_sk = d_date_sk
+ and d_date between cast('2002-01-05' as date)
+ and (cast('2002-01-05' as date) + 30 days)
+group by
+ i_item_id
+ ,i_item_desc
+ ,i_category
+ ,i_class
+ ,i_current_price
+order by
+ i_category
+ ,i_class
+ ,i_item_id
+ ,i_item_desc
+ ,revenueratio;
+
+-- end query 1 in stream 0 using template query98.tpl
diff --git a/modules/sql-engine/src/testFixtures/resources/tpcds/query99.sql b/modules/sql-engine/src/testFixtures/resources/tpcds/query99.sql
new file mode 100644
index 0000000000..0f420a9eba
--- /dev/null
+++ b/modules/sql-engine/src/testFixtures/resources/tpcds/query99.sql
@@ -0,0 +1,35 @@
+-- start query 1 in stream 0 using template query99.tpl and seed 1819994127
+select
+ substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,cc_name
+ ,sum(case when (cs_ship_date_sk - cs_sold_date_sk <= 30 ) then 1 else 0 end) as `30 days`
+ ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 30) and
+ (cs_ship_date_sk - cs_sold_date_sk <= 60) then 1 else 0 end ) as `31-60 days`
+ ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 60) and
+ (cs_ship_date_sk - cs_sold_date_sk <= 90) then 1 else 0 end) as `61-90 days`
+ ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 90) and
+ (cs_ship_date_sk - cs_sold_date_sk <= 120) then 1 else 0 end) as `91-120 days`
+ ,sum(case when (cs_ship_date_sk - cs_sold_date_sk > 120) then 1 else 0 end) as `>120 days`
+from
+ catalog_sales
+ ,warehouse
+ ,ship_mode
+ ,call_center
+ ,date_dim
+where
+ d_month_seq between 1178 and 1178 + 11
+and cs_ship_date_sk = d_date_sk
+and cs_warehouse_sk = w_warehouse_sk
+and cs_ship_mode_sk = sm_ship_mode_sk
+and cs_call_center_sk = cc_call_center_sk
+group by
+ substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,cc_name
+order by substr(w_warehouse_name,1,20)
+ ,sm_type
+ ,cc_name
+limit 100;
+
+-- end query 1 in stream 0 using template query99.tpl