diff --git a/README.md b/README.md index 3e666efb..49161220 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,12 @@ This repository is organized into different sections to help you navigate throug - **Location:** `community-samples` folder. - **Description:** These samples have been created by our community. They showcase creative ways to use Microsoft Fabric and provide valuable insights into real-world scenarios. - + +### [End-to-end samples](./e2e-samples/) + +- **Location:** `e2e-samples` folder. +- **Description:** These samples have been created by our community. They showcase creative ways to use Microsoft Fabric and provide valuable insights into real-world scenarios. + ## Learning Resources ### Microsoft Learn diff --git a/e2e-samples/README.md b/e2e-samples/README.md index 8f89f159..3fbe9234 100644 --- a/e2e-samples/README.md +++ b/e2e-samples/README.md @@ -2,4 +2,8 @@ > **Note**: > Git API samples have been moved [here](https://github.com/microsoft/fabric-samples/tree/main/features-samples/git-integration). -> API Integration sample have been moved [here](https://github.com/microsoft/fabric-samples/tree/main/features-samples/fabric-apis). \ No newline at end of file +> API Integration sample have been moved [here](https://github.com/microsoft/fabric-samples/tree/main/features-samples/fabric-apis). + +## [TPC samples](./tpc-samples/) + +Provides setup scripts and queries for TPCH test by [TPC-Homepage](https://www.tpc.org/). diff --git a/e2e-samples/tpc-samples/README.md b/e2e-samples/tpc-samples/README.md new file mode 100644 index 00000000..cc914ecd --- /dev/null +++ b/e2e-samples/tpc-samples/README.md @@ -0,0 +1,106 @@ +# TPCH benchmark setup guide for Fabric Warehouse + +This guide provides instructions for setting up querying part of TPC-H performance benchmarks using Microsoft Fabric Warehouse, aiming to achieve the best possible performance. While it does not cover the whole benchmarks, it covers querying part of the benchmarks and can be used as a sample workload. + +These workload are derived from the TPC-H Benchmark and is not comparable to published TPC-H Benchmark results, as these implementations do not comply with all requirements of the TPC-H Benchmark. For official benchmark guidelines, please refer to [TPC-Homepage](https://www.tpc.org/). + +Key TPC-H characteristics: + +| **Aspect** | **TPC-H** | +| ------------------- | ------------------------------------------------------------ | +| **Purpose** | Measures decision support system performance in a data warehouse context. | +| **Data Model** | Retail product supplier schema, broadly applicable. | +| **Schema** | 8 tables | +| **Queries** | Set of 22 ad-hoc queries simulating business intelligence workloads. | +| **Characteristics** | · OLAP workload · Large data volumes · High CPU and I/O demands | + +To maximize performance in these performance benchmarks, it's crucial to adhere closely to the guidelines outlined in this document. + +This guide provides: + +- Object creation guidelines and scripts + +- Data in parquet format + +- Ingestion scripts + +- Post-ingestion conditioning script + +- TPC-H queries + +This guide does not provide: + +- Guidance on creating TPC-H dataset. Provided scripts ingest data that is already generated for you. +- Guidance on running non-querying parts of benchmark. +- Tool to execute queries. You can use tool of your choice that works with Fabric Warehouse. + +Useful links: + +- [Enable Microsoft Fabric for your organization - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/admin/fabric-switch) +- Start [Fabric trial - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/get-started/fabric-trial) + +- [Create a workspace - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/get-started/create-workspaces) + +- [Create a Warehouse - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/data-warehouse/create-warehouse) + +- [Find your Fabric home region - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/admin/find-fabric-home-region) + +- Detailed list of [Warehouse performance guidelines - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance) + +## Prerequisites + +Before continuing, please make sure you have: + +- Familiarity with TPC-H benchmarks. + +- Access to Fabric workspace; useful links: [Getting Started | Microsoft Fabric](https://www.microsoft.com/en-us/microsoft-fabric/getting-started) and [Create a workspace - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/get-started/create-workspaces) + +- 1 empty Warehouse; useful link: [Create a Warehouse - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/data-warehouse/create-warehouse) + +## Step 1 - Create database objects + +This step creates necessary tables in the warehouse, in a way to get optimal performance. Complete list of tables, columns and data types can be found [here](./data-types.md). + +**Preparation**: Ensure that you have already set up a data warehouse. This is a prerequisite for the steps that follow. + +**Script Execution**: Execute "1-Create objects" script from the appropriate setup folder in [tpch](./tpch/). + +**Best practices** (already applied for you in the provided script)**:** The crucial point is to [choose the best data type for performance](https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance#choose-the-best-data-type-for-performance): + +- **String Data Types**: Choose string data types that are sufficiently long to hold the required values without excess. Avoid overly large string lengths to enhance performance. +- **Integer Data Types**: Prefer **int** data types over **bigint** wherever feasible. This choice can significantly improve performance, as **int** is generally more performance-friendly in most scenarios. +- **Decimal Data Types**: Opt for decimals with a smaller precision and scale than the default settings. Adjusting these parameters to the minimum necessary can lead to more efficient data processing and storage. +- **Nullability**: Prefer NOT NULL over NULL wherever possible. +- Make sure join columns are of the same type. + +By following these steps, you'll be well-positioned to achieve optimal performance in your benchmark testing. Remember, the key is in the details, especially when selecting the most suitable data types for your specific data needs. + +## Step 2 - Ingest the data + +This step involves importing data into your warehouse. When you use Fabric for data ingestion, the data will be formatted in a way that is optimized for performance. All ingestion into warehouse options are described in [data ingestion guidelines](https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance#data-ingestion-guidelines). + +Below, you will find the specific script for the warehouse to facilitate this data ingestion. + +**Preparation**: N/A - scripts that ingest the data from the public storage account are provided in this repo. + +**Script Execution**: Execute "2-Ingest data" from the appropriate setup folder in [tpch](./tpch/). + +**Best practices** (already applied for you): + +- **Number of source files**: For large files, consider splitting your file into multiple files. Delta or parquet format would be preferred over csv due to compression. +- **Source file sizes**: Files should be at least 4 MB in size. +- **Collocation**: For optimal performance, ensure that your source data is in the same geographical region as your warehouse. Storage account used in this repo is in West US 2 region. + +Please note that duration of this step may vary depending whether your warehouse is in the same region as source storage account. + +## Step 3 - Post-ingestion conditioning + +This step guarantees that the query optimizer has access to the most comprehensive statistics during the query optimization phase. Typically, statistics are automatically generated as needed, drawing from a subset of column values within the table. However, the statistics produced using this script will encompass all values, thereby equipping the query optimizer with the necessary data to determine the most efficient plan. + +**Script Execution**: Execute ["3-Post ingestion conditioning"] from the appropriate setup folder in [tpch](./tpch/). + +## Step 4 - Benchmark execution + +Feel free to use any benchmarking tool compatible with Fabric. However, it's important to [collocate client applications and Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/data-warehouse/guidelines-warehouse-performance#collocate-client-applications-and-microsoft-fabric) to ensure that the tool is located in the same geographical region as your warehouse. Adhering to the guidelines outlined in this document will not only help you attain optimal performance in this benchmark but also enhance efficiency in your regular workloads. + +You can find scripts in relevant queries folder in [tpch](./tpch/). diff --git a/e2e-samples/tpc-samples/data-types.md b/e2e-samples/tpc-samples/data-types.md new file mode 100644 index 00000000..bc6870bc --- /dev/null +++ b/e2e-samples/tpc-samples/data-types.md @@ -0,0 +1,71 @@ +# Data types + +This document contains list of all tables, columns and data types used in benchmarks: + +- [TPC-H data types](#tpc-h-data-types) + +## TPC-H data types + +| Table | Column | TPCH 1TB | +| -------- | --------------- | ------------------------ | +| customer | c_custkey | bigint NOT NULL | +| customer | c_name | varchar(25) NOT NULL | +| customer | c_address | varchar(40) NOT NULL | +| customer | c_nationkey | int NOT NULL | +| customer | c_phone | varchar(15) NOT NULL | +| customer | c_acctbal | decimal(12, 2) NOT NULL | +| customer | c_mktsegment | varchar(10) NOT NULL | +| customer | c_comment | varchar(117) NOT NULL | +| lineitem | l_orderkey | bigint NOT NULL | +| lineitem | l_partkey | bigint NOT NULL | +| lineitem | l_suppkey | bigint NOT NULL | +| lineitem | l_linenumber | int NOT NULL | +| lineitem | l_quantity | decimal(12, 2) NOT NULL | +| lineitem | l_extendedprice | decimal(12, 2) NOT NULL | +| lineitem | l_discount | decimal(12, 2) NOT NULL | +| lineitem | l_tax | decimal(12, 2) NOT NULL | +| lineitem | l_returnflag | varchar(1) NOT NULL | +| lineitem | l_linestatus | varchar(1) NOT NULL | +| lineitem | l_shipdate | date NOT NULL | +| lineitem | l_commitdate | date NOT NULL | +| lineitem | l_receiptdate | date NOT NULL | +| lineitem | l_shipinstruct | varchar(25) NOT NULL | +| lineitem | l_shipmode | varchar(10) NOT NULL | +| lineitem | l_comment | varchar(44) NOT NULL | +| nation | n_nationkey | int NOT NULL | +| nation | n_name | varchar(25) NOT NULL | +| nation | n_regionkey | int NOT NULL | +| nation | n_comment | varchar(152) NOT NULL | +| orders | o_orderkey | bigint NOT NULL | +| orders | o_custkey | bigint NOT NULL | +| orders | o_orderstatus | varchar(1) NOT NULL | +| orders | o_totalprice | decimal(12, 2) NOT NULL | +| orders | o_orderdate | date NOT NULL | +| orders | o_orderpriority | varchar(15) NOT NULL | +| orders | o_clerk | varchar(15) NOT NULL | +| orders | o_shippriority | int NOT NULL | +| orders | o_comment | varchar(79) NOT NULL | +| part | p_partkey | bigint NOT NULL | +| part | p_name | varchar(55) NOT NULL | +| part | p_mfgr | varchar(25) NOT NULL | +| part | p_brand | varchar(10) NOT NULL | +| part | p_type | varchar(25) NOT NULL | +| part | p_size | int NOT NULL | +| part | p_container | varchar(10) NOT NULL | +| part | p_retailprice | decimal(12, 2) NOT NULL | +| part | p_comment | varchar(23) NOT NULL | +| partsupp | ps_partkey | bigint NOT NULL | +| partsupp | ps_suppkey | bigint NOT NULL | +| partsupp | ps_availqty | int NOT NULL | +| partsupp | ps_supplycost | decimal(12, 2) NOT NULL | +| partsupp | ps_comment | varchar(199) NOT NULL | +| region | r_regionkey | int NOT NULL | +| region | r_name | varchar(25) NOT NULL | +| region | r_comment | varchar(152) NOT NULL | +| supplier | s_suppkey | bigint NOT NULL | +| supplier | s_name | varchar(25) NOT NULL | +| supplier | s_address | varchar(40) NOT NULL | +| supplier | s_nationkey | int NOT NULL | +| supplier | s_phone | varchar(15) NOT NULL | +| supplier | s_acctbal | decimal(12, 2) NOT NULL | +| supplier | s_comment | varchar(101) NOT NULL | diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Queries.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Queries.sql new file mode 100644 index 00000000..b048a7a5 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Queries.sql @@ -0,0 +1,751 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 01 *************************************/ + + select + l_returnflag, + l_linestatus, + sum(l_quantity) as sum_qty, + sum(l_extendedprice) as sum_base_price, + sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, + sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, + avg(l_quantity) as avg_qty, + avg(l_extendedprice) as avg_price, + avg(l_discount) as avg_disc, + count_big(*) as count_order /* count(*) as count_order */ + from + lineitem + where + l_shipdate <= dateadd(day, -88, '1998-12-01') /* l_shipdate <= date '1998-12-01' - interval '88' day (3) */ + group by + l_returnflag, + l_linestatus + order by + l_returnflag, + l_linestatus + option (label = 'TPC-H Query 01'); + + + /************************************* TPC-H Query 02 *************************************/ + + select top 100 + s_acctbal, + s_name, + n_name, + p_partkey, + p_mfgr, + s_address, + s_phone, + s_comment + from + part, + supplier, + partsupp, + nation, + region + where + p_partkey = ps_partkey + and s_suppkey = ps_suppkey + and p_size = 38 + and p_type like '%TIN' + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + and ps_supplycost = ( + select + min(ps_supplycost) + from + partsupp, + supplier, + nation, + region + where + p_partkey = ps_partkey + and s_suppkey = ps_suppkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + ) + order by + s_acctbal desc, + n_name, + s_name, + p_partkey + option (label = 'TPC-H Query 02'); + + + /************************************* TPC-H Query 03 *************************************/ + + select top 10 + l_orderkey, + sum(l_extendedprice * (1 - l_discount)) as revenue, + o_orderdate, + o_shippriority + from + customer, + orders, + lineitem + where + c_mktsegment = 'MACHINERY' + and c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate < '1995-03-24' /* and o_orderdate < date '1995-03-24' */ + and l_shipdate > '1995-03-24' /* and l_shipdate > date '1995-03-24' */ + group by + l_orderkey, + o_orderdate, + o_shippriority + order by + revenue desc, + o_orderdate + option (label = 'TPC-H Query 03'); + + + /************************************* TPC-H Query 04 *************************************/ + + select + o_orderpriority, + count_big(*) as order_count /* count(*) as order_count */ + from + orders + where + o_orderdate >= '1996-09-01' /* o_orderdate >= date '1996-09-01' */ + and o_orderdate < dateadd(month, +3, '1996-09-01') /* and o_orderdate < date '1996-09-01' + interval '3' month */ + and exists ( + select + * + from + lineitem + where + l_orderkey = o_orderkey + and l_commitdate < l_receiptdate + ) + group by + o_orderpriority + order by + o_orderpriority + option (label = 'TPC-H Query 04'); + + + /************************************* TPC-H Query 05 *************************************/ + + select + n_name, + sum(l_extendedprice * (1 - l_discount)) as revenue + from + customer, + orders, + lineitem, + supplier, + nation, + region + where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and l_suppkey = s_suppkey + and c_nationkey = s_nationkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'ASIA' + and o_orderdate >= '1994-01-01' /* and o_orderdate >= date '1994-01-01' */ + and o_orderdate < dateadd(year, +1, '1994-01-01') /* and o_orderdate < date '1994-01-01' + interval '1' year */ + group by + n_name + order by + revenue desc + option (label = 'TPC-H Query 05'); + + + /************************************* TPC-H Query 06 *************************************/ + + select + sum(l_extendedprice * l_discount) as revenue + from + lineitem + where + l_shipdate >= '1994-01-01' /* l_shipdate >= date '1994-01-01' */ + and l_shipdate < dateadd(year, +1, '1994-01-01') /* and l_shipdate < date '1994-01-01' + interval '1' year */ + and l_discount between 0.04 - 0.01 and 0.04 + 0.01 + and l_quantity < 24 + option (label = 'TPC-H Query 06'); + + + /************************************* TPC-H Query 07 *************************************/ + + select + supp_nation, + cust_nation, + l_year, + sum(volume) as revenue + from + ( + select + n1.n_name as supp_nation, + n2.n_name as cust_nation, + datepart(year, l_shipdate) as l_year, /* extract(year from l_shipdate) as l_year, */ + l_extendedprice * (1 - l_discount) as volume + from + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2 + where + s_suppkey = l_suppkey + and o_orderkey = l_orderkey + and c_custkey = o_custkey + and s_nationkey = n1.n_nationkey + and c_nationkey = n2.n_nationkey + and ( + (n1.n_name = 'FRANCE' and n2.n_name = 'ALGERIA') + or (n1.n_name = 'ALGERIA' and n2.n_name = 'FRANCE') + ) + and l_shipdate between '1995-01-01' and '1996-12-31' /* and l_shipdate between date '1995-01-01' and date '1996-12-31' */ + ) as shipping + group by + supp_nation, + cust_nation, + l_year + order by + supp_nation, + cust_nation, + l_year + option (label = 'TPC-H Query 07'); + + + /************************************* TPC-H Query 08 *************************************/ + + select + o_year, + sum(case + when nation = 'ALGERIA' then volume + else 0 + end) / sum(volume) as mkt_share + from + ( + select + datepart(year, o_orderdate) as o_year, /* extract(year from o_orderdate) as o_year, */ + l_extendedprice * (1 - l_discount) as volume, + n2.n_name as nation + from + part, + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2, + region + where + p_partkey = l_partkey + and s_suppkey = l_suppkey + and l_orderkey = o_orderkey + and o_custkey = c_custkey + and c_nationkey = n1.n_nationkey + and n1.n_regionkey = r_regionkey + and r_name = 'AFRICA' + and s_nationkey = n2.n_nationkey + and o_orderdate between '1995-01-01' and '1996-12-31' /* and o_orderdate between date '1995-01-01' and date '1996-12-31' */ + and p_type = 'STANDARD BURNISHED STEEL' + ) as all_nations + group by + o_year + order by + o_year + option (label = 'TPC-H Query 08'); + + + /************************************* TPC-H Query 09 *************************************/ + + select + nation, + o_year, + sum(amount) as sum_profit + from + ( + select + n_name as nation, + datepart(year, o_orderdate) as o_year, /* extract(year from o_orderdate) as o_year, */ + l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount + from + part, + supplier, + lineitem, + partsupp, + orders, + nation + where + s_suppkey = l_suppkey + and ps_suppkey = l_suppkey + and ps_partkey = l_partkey + and p_partkey = l_partkey + and o_orderkey = l_orderkey + and s_nationkey = n_nationkey + and p_name like '%bisque%' + ) as profit + group by + nation, + o_year + order by + nation, + o_year desc + option (label = 'TPC-H Query 09'); + + + /************************************* TPC-H Query 10 *************************************/ + + select top 20 + c_custkey, + c_name, + sum(l_extendedprice * (1 - l_discount)) as revenue, + c_acctbal, + n_name, + c_address, + c_phone, + c_comment + from + customer, + orders, + lineitem, + nation + where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate >= '1993-06-01' /* and o_orderdate >= date '1993-06-01' */ + and o_orderdate < dateadd(month, +3, '1993-06-01') /* and o_orderdate < date '1993-06-01' + interval '3' month */ + and l_returnflag = 'R' + and c_nationkey = n_nationkey + group by + c_custkey, + c_name, + c_acctbal, + c_phone, + n_name, + c_address, + c_comment + order by + revenue desc + option (label = 'TPC-H Query 10'); + + + /************************************* TPC-H Query 11 *************************************/ + + select + ps_partkey, + sum(ps_supplycost * ps_availqty) as value + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'CHINA' + group by + ps_partkey having + sum(ps_supplycost * ps_availqty) > ( + select + sum(ps_supplycost * ps_availqty) * 0.0000001000 + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'CHINA' + ) + order by + value desc + option (label = 'TPC-H Query 11'); + + + /************************************* TPC-H Query 12 *************************************/ + + select + l_shipmode, + sum(case + when o_orderpriority = '1-URGENT' + or o_orderpriority = '2-HIGH' + then 1 + else 0 + end) as high_line_count, + sum(case + when o_orderpriority <> '1-URGENT' + and o_orderpriority <> '2-HIGH' + then 1 + else 0 + end) as low_line_count + from + orders, + lineitem + where + o_orderkey = l_orderkey + and l_shipmode in ('FOB', 'REG AIR') + and l_commitdate < l_receiptdate + and l_shipdate < l_commitdate + and l_receiptdate >= '1993-01-01' /* and l_receiptdate >= date '1993-01-01' */ + and l_receiptdate < dateadd(year, +1, '1993-01-01') /* and l_receiptdate < date '1993-01-01' + interval '1' year */ + group by + l_shipmode + order by + l_shipmode + option (label = 'TPC-H Query 12'); + + + /************************************* TPC-H Query 13 *************************************/ + + select + c_count, + count(*) as custdist + from + ( + select + c_custkey, + count(o_orderkey) + from + customer left outer join orders on + c_custkey = o_custkey + and o_comment not like '%special%packages%' + group by + c_custkey + ) as c_orders (c_custkey, c_count) + group by + c_count + order by + custdist desc, + c_count desc + option (label = 'TPC-H Query 13'); + + + /************************************* TPC-H Query 14 *************************************/ + + select + 100.00 * sum(case + when p_type like 'PROMO%' + then l_extendedprice * (1 - l_discount) + else 0 + end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue + from + lineitem, + part + where + l_partkey = p_partkey + and l_shipdate >= '1993-11-01' /* and l_shipdate >= date '1993-11-01' */ + and l_shipdate < dateadd(month, +1, '1993-11-01') /* and l_shipdate < date '1993-11-01' + interval '1' month */ + option (label = 'TPC-H Query 14'); + + + /************************************* TPC-H Query 15 *************************************/ + + drop view if exists revenue0 /* New line added for error handling. */ + EXEC ('create view revenue0 (supplier_no, total_revenue) as + select + l_suppkey, + sum(l_extendedprice * (1 - l_discount)) + from + lineitem + where + l_shipdate >= ''1995-03-01'' /* l_shipdate >= date ''1995-03-01'' */ + and l_shipdate < dateadd(month, +3, ''1995-03-01'') /* and l_shipdate < date ''1995-03-01'' + interval ''3'' month */ + group by + l_suppkey') + + + select + s_suppkey, + s_name, + s_address, + s_phone, + total_revenue + from + supplier, + revenue0 + where + s_suppkey = supplier_no + and total_revenue = ( + select + max(total_revenue) + from + revenue0 + ) + order by + s_suppkey + option (label = 'TPC-H Query 15'); + + + drop view if exists revenue0 /* drop view revenue0 */ + + + /************************************* TPC-H Query 16 *************************************/ + + select + p_brand, + p_type, + p_size, + count(distinct ps_suppkey) as supplier_cnt + from + partsupp, + part + where + p_partkey = ps_partkey + and p_brand <> 'Brand#15' + and p_type not like 'ECONOMY BRUSHED%' + and p_size in (7, 22, 42, 4, 39, 1, 41, 45) + and ps_suppkey not in ( + select + s_suppkey + from + supplier + where + s_comment like '%Customer%Complaints%' + ) + group by + p_brand, + p_type, + p_size + order by + supplier_cnt desc, + p_brand, + p_type, + p_size + option (label = 'TPC-H Query 16'); + + + /************************************* TPC-H Query 17 *************************************/ + + select + sum(l_extendedprice) / 7.0 as avg_yearly + from + lineitem, + part + where + p_partkey = l_partkey + and p_brand = 'Brand#55' + and p_container = 'SM PACK' + and l_quantity < ( + select + 0.2 * avg(l_quantity) + from + lineitem + where + l_partkey = p_partkey + ) + option (label = 'TPC-H Query 17'); + + + /************************************* TPC-H Query 18 *************************************/ + + select top 100 + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice, + sum(l_quantity) + from + customer, + orders, + lineitem + where + o_orderkey in ( + select + l_orderkey + from + lineitem + group by + l_orderkey having + sum(l_quantity) > 315 + ) + and c_custkey = o_custkey + and o_orderkey = l_orderkey + group by + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice + order by + o_totalprice desc, + o_orderdate + option (label = 'TPC-H Query 18'); + + + /************************************* TPC-H Query 19 *************************************/ + + select + sum(l_extendedprice* (1 - l_discount)) as revenue + from + lineitem, + part + where + ( + p_partkey = l_partkey + and p_brand = 'Brand#13' + and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') + and l_quantity >= 8 and l_quantity <= 8 + 10 + and p_size between 1 and 5 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or + ( + p_partkey = l_partkey + and p_brand = 'Brand#51' + and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') + and l_quantity >= 19 and l_quantity <= 19 + 10 + and p_size between 1 and 10 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or + ( + p_partkey = l_partkey + and p_brand = 'Brand#41' + and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') + and l_quantity >= 22 and l_quantity <= 22 + 10 + and p_size between 1 and 15 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + option (label = 'TPC-H Query 19'); + + + /************************************* TPC-H Query 20 *************************************/ + + select + s_name, + s_address + from + supplier, + nation + where + s_suppkey in ( + select + ps_suppkey + from + partsupp + where + ps_partkey in ( + select + p_partkey + from + part + where + p_name like 'ivory%' + ) + and ps_availqty > ( + select + 0.5 * sum(l_quantity) + from + lineitem + where + l_partkey = ps_partkey + and l_suppkey = ps_suppkey + and l_shipdate >= '1997-01-01' /* and l_shipdate >= date '1997-01-01' */ + and l_shipdate < dateadd(year, +1, '1997-01-01') /* and l_shipdate < date '1997-01-01' + interval '1' year */ + ) + ) + and s_nationkey = n_nationkey + and n_name = 'ALGERIA' + order by + s_name + option (label = 'TPC-H Query 20'); + + + /************************************* TPC-H Query 21 *************************************/ + + select top 100 + s_name, + count(*) as numwait + from + supplier, + lineitem l1, + orders, + nation + where + s_suppkey = l1.l_suppkey + and o_orderkey = l1.l_orderkey + and o_orderstatus = 'F' + and l1.l_receiptdate > l1.l_commitdate + and exists ( + select + * + from + lineitem l2 + where + l2.l_orderkey = l1.l_orderkey + and l2.l_suppkey <> l1.l_suppkey + ) + and not exists ( + select + * + from + lineitem l3 + where + l3.l_orderkey = l1.l_orderkey + and l3.l_suppkey <> l1.l_suppkey + and l3.l_receiptdate > l3.l_commitdate + ) + and s_nationkey = n_nationkey + and n_name = 'SAUDI ARABIA' + group by + s_name + order by + numwait desc, + s_name + option (label = 'TPC-H Query 21'); + + + /************************************* TPC-H Query 22 *************************************/ + + select + cntrycode, + count(*) as numcust, + sum(c_acctbal) as totacctbal + from + ( + select + substring(c_phone, 1, 2) as cntrycode, /* substring(c_phone from 1 for 2) as cntrycode, */ + c_acctbal + from + customer + where + substring(c_phone, 1, 2) in /* substring(c_phone from 1 for 2) in */ + ('10', '29', '12', '30', '32', '18', '17') + and c_acctbal > ( + select + avg(c_acctbal) + from + customer + where + c_acctbal > 0.00 + and substring(c_phone, 1, 2) in /* and substring(c_phone from 1 for 2) in */ + ('10', '29', '12', '30', '32', '18', '17') + ) + and not exists ( + select + * + from + orders + where + o_custkey = c_custkey + ) + ) as custsale + group by + cntrycode + order by + cntrycode + option (label = 'TPC-H Query 22'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 01.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 01.sql new file mode 100644 index 00000000..9e44ebc3 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 01.sql @@ -0,0 +1,37 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 01 *************************************/ + + select + l_returnflag, + l_linestatus, + sum(l_quantity) as sum_qty, + sum(l_extendedprice) as sum_base_price, + sum(l_extendedprice * (1 - l_discount)) as sum_disc_price, + sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge, + avg(l_quantity) as avg_qty, + avg(l_extendedprice) as avg_price, + avg(l_discount) as avg_disc, + count_big(*) as count_order /* count(*) as count_order */ + from + lineitem + where + l_shipdate <= dateadd(day, -88, '1998-12-01') /* l_shipdate <= date '1998-12-01' - interval '88' day (3) */ + group by + l_returnflag, + l_linestatus + order by + l_returnflag, + l_linestatus + option (label = 'TPC-H Query 01'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 02.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 02.sql new file mode 100644 index 00000000..bbd98917 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 02.sql @@ -0,0 +1,59 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 02 *************************************/ + + select top 100 + s_acctbal, + s_name, + n_name, + p_partkey, + p_mfgr, + s_address, + s_phone, + s_comment + from + part, + supplier, + partsupp, + nation, + region + where + p_partkey = ps_partkey + and s_suppkey = ps_suppkey + and p_size = 38 + and p_type like '%TIN' + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + and ps_supplycost = ( + select + min(ps_supplycost) + from + partsupp, + supplier, + nation, + region + where + p_partkey = ps_partkey + and s_suppkey = ps_suppkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'EUROPE' + ) + order by + s_acctbal desc, + n_name, + s_name, + p_partkey + option (label = 'TPC-H Query 02'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 03.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 03.sql new file mode 100644 index 00000000..36713754 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 03.sql @@ -0,0 +1,38 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 03 *************************************/ + + select top 10 + l_orderkey, + sum(l_extendedprice * (1 - l_discount)) as revenue, + o_orderdate, + o_shippriority + from + customer, + orders, + lineitem + where + c_mktsegment = 'MACHINERY' + and c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate < '1995-03-24' /* and o_orderdate < date '1995-03-24' */ + and l_shipdate > '1995-03-24' /* and l_shipdate > date '1995-03-24' */ + group by + l_orderkey, + o_orderdate, + o_shippriority + order by + revenue desc, + o_orderdate + option (label = 'TPC-H Query 03'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 04.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 04.sql new file mode 100644 index 00000000..cc82cd4b --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 04.sql @@ -0,0 +1,37 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 04 *************************************/ + + select + o_orderpriority, + count_big(*) as order_count /* count(*) as order_count */ + from + orders + where + o_orderdate >= '1996-09-01' /* o_orderdate >= date '1996-09-01' */ + and o_orderdate < dateadd(month, +3, '1996-09-01') /* and o_orderdate < date '1996-09-01' + interval '3' month */ + and exists ( + select + * + from + lineitem + where + l_orderkey = o_orderkey + and l_commitdate < l_receiptdate + ) + group by + o_orderpriority + order by + o_orderpriority + option (label = 'TPC-H Query 04'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 05.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 05.sql new file mode 100644 index 00000000..d3db2c42 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 05.sql @@ -0,0 +1,40 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 05 *************************************/ + + select + n_name, + sum(l_extendedprice * (1 - l_discount)) as revenue + from + customer, + orders, + lineitem, + supplier, + nation, + region + where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and l_suppkey = s_suppkey + and c_nationkey = s_nationkey + and s_nationkey = n_nationkey + and n_regionkey = r_regionkey + and r_name = 'ASIA' + and o_orderdate >= '1994-01-01' /* and o_orderdate >= date '1994-01-01' */ + and o_orderdate < dateadd(year, +1, '1994-01-01') /* and o_orderdate < date '1994-01-01' + interval '1' year */ + group by + n_name + order by + revenue desc + option (label = 'TPC-H Query 05'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 06.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 06.sql new file mode 100644 index 00000000..f07f1ff7 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 06.sql @@ -0,0 +1,25 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 06 *************************************/ + + select + sum(l_extendedprice * l_discount) as revenue + from + lineitem + where + l_shipdate >= '1994-01-01' /* l_shipdate >= date '1994-01-01' */ + and l_shipdate < dateadd(year, +1, '1994-01-01') /* and l_shipdate < date '1994-01-01' + interval '1' year */ + and l_discount between 0.04 - 0.01 and 0.04 + 0.01 + and l_quantity < 24 + option (label = 'TPC-H Query 06'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 07.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 07.sql new file mode 100644 index 00000000..696e9602 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 07.sql @@ -0,0 +1,55 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 07 *************************************/ + + select + supp_nation, + cust_nation, + l_year, + sum(volume) as revenue + from + ( + select + n1.n_name as supp_nation, + n2.n_name as cust_nation, + datepart(year, l_shipdate) as l_year, /* extract(year from l_shipdate) as l_year, */ + l_extendedprice * (1 - l_discount) as volume + from + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2 + where + s_suppkey = l_suppkey + and o_orderkey = l_orderkey + and c_custkey = o_custkey + and s_nationkey = n1.n_nationkey + and c_nationkey = n2.n_nationkey + and ( + (n1.n_name = 'FRANCE' and n2.n_name = 'ALGERIA') + or (n1.n_name = 'ALGERIA' and n2.n_name = 'FRANCE') + ) + and l_shipdate between '1995-01-01' and '1996-12-31' /* and l_shipdate between date '1995-01-01' and date '1996-12-31' */ + ) as shipping + group by + supp_nation, + cust_nation, + l_year + order by + supp_nation, + cust_nation, + l_year + option (label = 'TPC-H Query 07'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 08.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 08.sql new file mode 100644 index 00000000..fd59b946 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 08.sql @@ -0,0 +1,53 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 08 *************************************/ + + select + o_year, + sum(case + when nation = 'ALGERIA' then volume + else 0 + end) / sum(volume) as mkt_share + from + ( + select + datepart(year, o_orderdate) as o_year, /* extract(year from o_orderdate) as o_year, */ + l_extendedprice * (1 - l_discount) as volume, + n2.n_name as nation + from + part, + supplier, + lineitem, + orders, + customer, + nation n1, + nation n2, + region + where + p_partkey = l_partkey + and s_suppkey = l_suppkey + and l_orderkey = o_orderkey + and o_custkey = c_custkey + and c_nationkey = n1.n_nationkey + and n1.n_regionkey = r_regionkey + and r_name = 'AFRICA' + and s_nationkey = n2.n_nationkey + and o_orderdate between '1995-01-01' and '1996-12-31' /* and o_orderdate between date '1995-01-01' and date '1996-12-31' */ + and p_type = 'STANDARD BURNISHED STEEL' + ) as all_nations + group by + o_year + order by + o_year + option (label = 'TPC-H Query 08'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 09.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 09.sql new file mode 100644 index 00000000..a1440396 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 09.sql @@ -0,0 +1,48 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 09 *************************************/ + + select + nation, + o_year, + sum(amount) as sum_profit + from + ( + select + n_name as nation, + datepart(year, o_orderdate) as o_year, /* extract(year from o_orderdate) as o_year, */ + l_extendedprice * (1 - l_discount) - ps_supplycost * l_quantity as amount + from + part, + supplier, + lineitem, + partsupp, + orders, + nation + where + s_suppkey = l_suppkey + and ps_suppkey = l_suppkey + and ps_partkey = l_partkey + and p_partkey = l_partkey + and o_orderkey = l_orderkey + and s_nationkey = n_nationkey + and p_name like '%bisque%' + ) as profit + group by + nation, + o_year + order by + nation, + o_year desc + option (label = 'TPC-H Query 09'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 10.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 10.sql new file mode 100644 index 00000000..a3a8da5a --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 10.sql @@ -0,0 +1,47 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 10 *************************************/ + + select top 20 + c_custkey, + c_name, + sum(l_extendedprice * (1 - l_discount)) as revenue, + c_acctbal, + n_name, + c_address, + c_phone, + c_comment + from + customer, + orders, + lineitem, + nation + where + c_custkey = o_custkey + and l_orderkey = o_orderkey + and o_orderdate >= '1993-06-01' /* and o_orderdate >= date '1993-06-01' */ + and o_orderdate < dateadd(month, +3, '1993-06-01') /* and o_orderdate < date '1993-06-01' + interval '3' month */ + and l_returnflag = 'R' + and c_nationkey = n_nationkey + group by + c_custkey, + c_name, + c_acctbal, + c_phone, + n_name, + c_address, + c_comment + order by + revenue desc + option (label = 'TPC-H Query 10'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 11.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 11.sql new file mode 100644 index 00000000..eff01b51 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 11.sql @@ -0,0 +1,43 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 11 *************************************/ + + select + ps_partkey, + sum(ps_supplycost * ps_availqty) as value + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'CHINA' + group by + ps_partkey having + sum(ps_supplycost * ps_availqty) > ( + select + sum(ps_supplycost * ps_availqty) * 0.0000001000 + from + partsupp, + supplier, + nation + where + ps_suppkey = s_suppkey + and s_nationkey = n_nationkey + and n_name = 'CHINA' + ) + order by + value desc + option (label = 'TPC-H Query 11'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 12.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 12.sql new file mode 100644 index 00000000..642872ef --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 12.sql @@ -0,0 +1,44 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 12 *************************************/ + + select + l_shipmode, + sum(case + when o_orderpriority = '1-URGENT' + or o_orderpriority = '2-HIGH' + then 1 + else 0 + end) as high_line_count, + sum(case + when o_orderpriority <> '1-URGENT' + and o_orderpriority <> '2-HIGH' + then 1 + else 0 + end) as low_line_count + from + orders, + lineitem + where + o_orderkey = l_orderkey + and l_shipmode in ('FOB', 'REG AIR') + and l_commitdate < l_receiptdate + and l_shipdate < l_commitdate + and l_receiptdate >= '1993-01-01' /* and l_receiptdate >= date '1993-01-01' */ + and l_receiptdate < dateadd(year, +1, '1993-01-01') /* and l_receiptdate < date '1993-01-01' + interval '1' year */ + group by + l_shipmode + order by + l_shipmode + option (label = 'TPC-H Query 12'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 13.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 13.sql new file mode 100644 index 00000000..d8e69402 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 13.sql @@ -0,0 +1,36 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 13 *************************************/ + + select + c_count, + count(*) as custdist + from + ( + select + c_custkey, + count(o_orderkey) + from + customer left outer join orders on + c_custkey = o_custkey + and o_comment not like '%special%packages%' + group by + c_custkey + ) as c_orders (c_custkey, c_count) + group by + c_count + order by + custdist desc, + c_count desc + option (label = 'TPC-H Query 13'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 14.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 14.sql new file mode 100644 index 00000000..36a7c173 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 14.sql @@ -0,0 +1,29 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 14 *************************************/ + + select + 100.00 * sum(case + when p_type like 'PROMO%' + then l_extendedprice * (1 - l_discount) + else 0 + end) / sum(l_extendedprice * (1 - l_discount)) as promo_revenue + from + lineitem, + part + where + l_partkey = p_partkey + and l_shipdate >= '1993-11-01' /* and l_shipdate >= date '1993-11-01' */ + and l_shipdate < dateadd(month, +1, '1993-11-01') /* and l_shipdate < date '1993-11-01' + interval '1' month */ + option (label = 'TPC-H Query 14'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 15.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 15.sql new file mode 100644 index 00000000..a01b0d00 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 15.sql @@ -0,0 +1,52 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 15 *************************************/ + + drop view if exists revenue0 /* New line added for error handling. */ + EXEC ('create view revenue0 (supplier_no, total_revenue) as + select + l_suppkey, + sum(l_extendedprice * (1 - l_discount)) + from + lineitem + where + l_shipdate >= ''1995-03-01'' /* l_shipdate >= date ''1995-03-01'' */ + and l_shipdate < dateadd(month, +3, ''1995-03-01'') /* and l_shipdate < date ''1995-03-01'' + interval ''3'' month */ + group by + l_suppkey') + + + select + s_suppkey, + s_name, + s_address, + s_phone, + total_revenue + from + supplier, + revenue0 + where + s_suppkey = supplier_no + and total_revenue = ( + select + max(total_revenue) + from + revenue0 + ) + order by + s_suppkey + option (label = 'TPC-H Query 15'); + + + drop view if exists revenue0 /* drop view revenue0 */ + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 16.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 16.sql new file mode 100644 index 00000000..3772d47b --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 16.sql @@ -0,0 +1,46 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 16 *************************************/ + + select + p_brand, + p_type, + p_size, + count(distinct ps_suppkey) as supplier_cnt + from + partsupp, + part + where + p_partkey = ps_partkey + and p_brand <> 'Brand#15' + and p_type not like 'ECONOMY BRUSHED%' + and p_size in (7, 22, 42, 4, 39, 1, 41, 45) + and ps_suppkey not in ( + select + s_suppkey + from + supplier + where + s_comment like '%Customer%Complaints%' + ) + group by + p_brand, + p_type, + p_size + order by + supplier_cnt desc, + p_brand, + p_type, + p_size + option (label = 'TPC-H Query 16'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 17.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 17.sql new file mode 100644 index 00000000..bd2bfd64 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 17.sql @@ -0,0 +1,33 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 17 *************************************/ + + select + sum(l_extendedprice) / 7.0 as avg_yearly + from + lineitem, + part + where + p_partkey = l_partkey + and p_brand = 'Brand#55' + and p_container = 'SM PACK' + and l_quantity < ( + select + 0.2 * avg(l_quantity) + from + lineitem + where + l_partkey = p_partkey + ) + option (label = 'TPC-H Query 17'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 18.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 18.sql new file mode 100644 index 00000000..56d65f5f --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 18.sql @@ -0,0 +1,48 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 18 *************************************/ + + select top 100 + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice, + sum(l_quantity) + from + customer, + orders, + lineitem + where + o_orderkey in ( + select + l_orderkey + from + lineitem + group by + l_orderkey having + sum(l_quantity) > 315 + ) + and c_custkey = o_custkey + and o_orderkey = l_orderkey + group by + c_name, + c_custkey, + o_orderkey, + o_orderdate, + o_totalprice + order by + o_totalprice desc, + o_orderdate + option (label = 'TPC-H Query 18'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 19.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 19.sql new file mode 100644 index 00000000..9522129f --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 19.sql @@ -0,0 +1,51 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 19 *************************************/ + + select + sum(l_extendedprice* (1 - l_discount)) as revenue + from + lineitem, + part + where + ( + p_partkey = l_partkey + and p_brand = 'Brand#13' + and p_container in ('SM CASE', 'SM BOX', 'SM PACK', 'SM PKG') + and l_quantity >= 8 and l_quantity <= 8 + 10 + and p_size between 1 and 5 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or + ( + p_partkey = l_partkey + and p_brand = 'Brand#51' + and p_container in ('MED BAG', 'MED BOX', 'MED PKG', 'MED PACK') + and l_quantity >= 19 and l_quantity <= 19 + 10 + and p_size between 1 and 10 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + or + ( + p_partkey = l_partkey + and p_brand = 'Brand#41' + and p_container in ('LG CASE', 'LG BOX', 'LG PACK', 'LG PKG') + and l_quantity >= 22 and l_quantity <= 22 + 10 + and p_size between 1 and 15 + and l_shipmode in ('AIR', 'AIR REG') + and l_shipinstruct = 'DELIVER IN PERSON' + ) + option (label = 'TPC-H Query 19'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 20.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 20.sql new file mode 100644 index 00000000..dea6ce2c --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 20.sql @@ -0,0 +1,53 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 20 *************************************/ + + select + s_name, + s_address + from + supplier, + nation + where + s_suppkey in ( + select + ps_suppkey + from + partsupp + where + ps_partkey in ( + select + p_partkey + from + part + where + p_name like 'ivory%' + ) + and ps_availqty > ( + select + 0.5 * sum(l_quantity) + from + lineitem + where + l_partkey = ps_partkey + and l_suppkey = ps_suppkey + and l_shipdate >= '1997-01-01' /* and l_shipdate >= date '1997-01-01' */ + and l_shipdate < dateadd(year, +1, '1997-01-01') /* and l_shipdate < date '1997-01-01' + interval '1' year */ + ) + ) + and s_nationkey = n_nationkey + and n_name = 'ALGERIA' + order by + s_name + option (label = 'TPC-H Query 20'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 21.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 21.sql new file mode 100644 index 00000000..6f54727c --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 21.sql @@ -0,0 +1,55 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 21 *************************************/ + + select top 100 + s_name, + count(*) as numwait + from + supplier, + lineitem l1, + orders, + nation + where + s_suppkey = l1.l_suppkey + and o_orderkey = l1.l_orderkey + and o_orderstatus = 'F' + and l1.l_receiptdate > l1.l_commitdate + and exists ( + select + * + from + lineitem l2 + where + l2.l_orderkey = l1.l_orderkey + and l2.l_suppkey <> l1.l_suppkey + ) + and not exists ( + select + * + from + lineitem l3 + where + l3.l_orderkey = l1.l_orderkey + and l3.l_suppkey <> l1.l_suppkey + and l3.l_receiptdate > l3.l_commitdate + ) + and s_nationkey = n_nationkey + and n_name = 'SAUDI ARABIA' + group by + s_name + order by + numwait desc, + s_name + option (label = 'TPC-H Query 21'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/queries/Query 22.sql b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 22.sql new file mode 100644 index 00000000..82865258 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/queries/Query 22.sql @@ -0,0 +1,53 @@ +/************************************* Notes *************************************/ +/* + Generated on 2024-10-03 + This is the TPC-H 1000 GB (TB_001) scale factor queries modified for Fabric DW T-SQL syntax. + + TPC-H Parameter Substitution (Version 3.0.0 build 0) + Using 81310311 as a seed to the RNG +*/ + + + + /************************************* TPC-H Query 22 *************************************/ + + select + cntrycode, + count(*) as numcust, + sum(c_acctbal) as totacctbal + from + ( + select + substring(c_phone, 1, 2) as cntrycode, /* substring(c_phone from 1 for 2) as cntrycode, */ + c_acctbal + from + customer + where + substring(c_phone, 1, 2) in /* substring(c_phone from 1 for 2) in */ + ('10', '29', '12', '30', '32', '18', '17') + and c_acctbal > ( + select + avg(c_acctbal) + from + customer + where + c_acctbal > 0.00 + and substring(c_phone, 1, 2) in /* and substring(c_phone from 1 for 2) in */ + ('10', '29', '12', '30', '32', '18', '17') + ) + and not exists ( + select + * + from + orders + where + o_custkey = c_custkey + ) + ) as custsale + group by + cntrycode + order by + cntrycode + option (label = 'TPC-H Query 22'); + + diff --git a/e2e-samples/tpc-samples/tpch/1tb/setup/1-Create objects.sql b/e2e-samples/tpc-samples/tpch/1tb/setup/1-Create objects.sql new file mode 100644 index 00000000..994836bb --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/setup/1-Create objects.sql @@ -0,0 +1,109 @@ +DROP TABLE IF EXISTS dbo.customer; +DROP TABLE IF EXISTS dbo.lineitem; +DROP TABLE IF EXISTS dbo.nation; +DROP TABLE IF EXISTS dbo.orders; +DROP TABLE IF EXISTS dbo.part; +DROP TABLE IF EXISTS dbo.partsupp; +DROP TABLE IF EXISTS dbo.region; +DROP TABLE IF EXISTS dbo.supplier; + + +CREATE TABLE dbo.customer + ( + c_custkey BIGINT NOT NULL, + c_name VARCHAR(25) NOT NULL, + c_address VARCHAR(40) NOT NULL, + c_nationkey INT NOT NULL, + c_phone VARCHAR(15) NOT NULL, + c_acctbal DECIMAL(12, 2) NOT NULL, + c_mktsegment VARCHAR(10) NOT NULL, + c_comment VARCHAR(117) NOT NULL + ); + + +CREATE TABLE dbo.lineitem + ( + l_orderkey BIGINT NOT NULL, + l_partkey BIGINT NOT NULL, + l_suppkey BIGINT NOT NULL, + l_linenumber INT NOT NULL, + l_quantity DECIMAL(12, 2) NOT NULL, + l_extendedprice DECIMAL(12, 2) NOT NULL, + l_discount DECIMAL(12, 2) NOT NULL, + l_tax DECIMAL(12, 2) NOT NULL, + l_returnflag VARCHAR(1) NOT NULL, + l_linestatus VARCHAR(1) NOT NULL, + l_shipdate DATE NOT NULL, + l_commitdate DATE NOT NULL, + l_receiptdate DATE NOT NULL, + l_shipinstruct VARCHAR(25) NOT NULL, + l_shipmode VARCHAR(10) NOT NULL, + l_comment VARCHAR(44) NOT NULL + ); + + +CREATE TABLE dbo.nation + ( + n_nationkey INT NOT NULL, + n_name VARCHAR(25) NOT NULL, + n_regionkey INT NOT NULL, + n_comment VARCHAR(152) NOT NULL + ); + + +CREATE TABLE dbo.orders + ( + o_orderkey BIGINT NOT NULL, + o_custkey BIGINT NOT NULL, + o_orderstatus VARCHAR(1) NOT NULL, + o_totalprice DECIMAL(12, 2) NOT NULL, + o_orderdate DATE NOT NULL, + o_orderpriority VARCHAR(15) NOT NULL, + o_clerk VARCHAR(15) NOT NULL, + o_shippriority INT NOT NULL, + o_comment VARCHAR(79) NOT NULL + ); + + +CREATE TABLE dbo.part + ( + p_partkey BIGINT NOT NULL, + p_name VARCHAR(55) NOT NULL, + p_mfgr VARCHAR(25) NOT NULL, + p_brand VARCHAR(10) NOT NULL, + p_type VARCHAR(25) NOT NULL, + p_size INT NOT NULL, + p_container VARCHAR(10) NOT NULL, + p_retailprice DECIMAL(12, 2) NOT NULL, + p_comment VARCHAR(23) NOT NULL + ); + + +CREATE TABLE dbo.partsupp + ( + ps_partkey BIGINT NOT NULL, + ps_suppkey BIGINT NOT NULL, + ps_availqty INT NOT NULL, + ps_supplycost DECIMAL(12, 2) NOT NULL, + ps_comment VARCHAR(199) NOT NULL + ); + + +CREATE TABLE dbo.region + ( + r_regionkey INT NOT NULL, + r_name VARCHAR(25) NOT NULL, + r_comment VARCHAR(152) NOT NULL + ); + + +CREATE TABLE dbo.supplier + ( + s_suppkey BIGINT NOT NULL, + s_name VARCHAR(25) NOT NULL, + s_address VARCHAR(40) NOT NULL, + s_nationkey INT NOT NULL, + s_phone VARCHAR(15) NOT NULL, + s_acctbal DECIMAL(12, 2) NOT NULL, + s_comment VARCHAR(101) NOT NULL + ); \ No newline at end of file diff --git a/e2e-samples/tpc-samples/tpch/1tb/setup/2-Ingest data.sql b/e2e-samples/tpc-samples/tpch/1tb/setup/2-Ingest data.sql new file mode 100644 index 00000000..d0ff226c --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/setup/2-Ingest data.sql @@ -0,0 +1,48 @@ +COPY INTO +[customer] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/customer/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[lineitem] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/lineitem/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[nation] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/nation/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[orders] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/orders/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[part] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/part/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[partsupp] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/partsupp/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[region] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/region/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + +COPY INTO +[supplier] +FROM 'https://dwsamples.blob.core.windows.net/tpch1tb/supplier/*.snappy.parquet' +WITH (FILE_TYPE = 'Parquet'); +GO + diff --git a/e2e-samples/tpc-samples/tpch/1tb/setup/3-Post ingestion conditioning.sql b/e2e-samples/tpc-samples/tpch/1tb/setup/3-Post ingestion conditioning.sql new file mode 100644 index 00000000..304be3f9 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/1tb/setup/3-Post ingestion conditioning.sql @@ -0,0 +1,127 @@ +CREATE STATISTICS [MANUAL_C_ACCTBAL] ON [customer](c_acctbal) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_ADDRESS] ON [customer](c_address) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_COMMENT] ON [customer](c_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_CUSTKEY] ON [customer](c_custkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_MKTSEGMENT] ON [customer](c_mktsegment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_NAME] ON [customer](c_name) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_NATIONKEY] ON [customer](c_nationkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_C_PHONE] ON [customer](c_phone) WITH SAMPLE 100 PERCENT + +GO +CREATE STATISTICS [MANUAL_L_COMMENT] ON [lineitem](l_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_COMMITDATE] ON [lineitem](l_commitdate) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_DISCOUNT] ON [lineitem](l_discount) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_EXTENDEDPRICE] ON [lineitem](l_extendedprice) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_LINENUMBER] ON [lineitem](l_linenumber) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_LINESTATUS] ON [lineitem](l_linestatus) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_ORDERKEY] ON [lineitem](l_orderkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_PARTKEY] ON [lineitem](l_partkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_QUANTITY] ON [lineitem](l_quantity) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_RECEIPTDATE] ON [lineitem](l_receiptdate) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_RETURNFLAG] ON [lineitem](l_returnflag) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_SHIPDATE] ON [lineitem](l_shipdate) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_SHIPINSTRUCT] ON [lineitem](l_shipinstruct) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_SHIPMODE] ON [lineitem](l_shipmode) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_SUPPKEY] ON [lineitem](l_suppkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_L_TAX] ON [lineitem](l_tax) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_N_COMMENT] ON [nation](n_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_N_NAME] ON [nation](n_name) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_N_NATIONKEY] ON [nation](n_nationkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_N_REGIONKEY] ON [nation](n_regionkey) WITH SAMPLE 100 PERCENT +GO + +CREATE STATISTICS [MANUAL_O_CLERK] ON [orders](o_clerk) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_COMMENT] ON [orders](o_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_CUSTKEY] ON [orders](o_custkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_ORDERDATE] ON [orders](o_orderdate) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_ORDERKEY] ON [orders](o_orderkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_ORDERPRIORITY] ON [orders](o_orderpriority) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_ORDERSTATUS] ON [orders](o_orderstatus) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_SHIPPRIORITY] ON [orders](o_shippriority) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_O_TOTALPRICE] ON [orders](o_totalprice) WITH SAMPLE 100 PERCENT +GO + +CREATE STATISTICS [MANUAL_P_BRAND] ON [part](p_brand) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_COMMENT] ON [part](p_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_CONTAINER] ON [part](p_container) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_MFGR] ON [part](p_mfgr) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_NAME] ON [part](p_name) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_PARTKEY] ON [part](p_partkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_RETAILPRICE] ON [part](p_retailprice) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_SIZE] ON [part](p_size) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_P_TYPE] ON [part](p_type) WITH SAMPLE 100 PERCENT +GO + +CREATE STATISTICS [MANUAL_PS_AVAILQTY] ON [partsupp](ps_availqty) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_PS_COMMENT] ON [partsupp](ps_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_PS_PARTKEY] ON [partsupp](ps_partkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_PS_SUPPKEY] ON [partsupp](ps_suppkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_PS_SUPPLYCOST] ON [partsupp](ps_supplycost) WITH SAMPLE 100 PERCENT +GO + +CREATE STATISTICS [MANUAL_R_COMMENT] ON [region](r_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_R_NAME] ON [region](r_name) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_R_REGIONKEY] ON [region](r_regionkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_ACCTBAL] ON [supplier](s_acctbal) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_ADDRESS] ON [supplier](s_address) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_COMMENT] ON [supplier](s_comment) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_NAME] ON [supplier](s_name) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_NATIONKEY] ON [supplier](s_nationkey) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_PHONE] ON [supplier](s_phone) WITH SAMPLE 100 PERCENT +GO +CREATE STATISTICS [MANUAL_S_SUPPKEY] ON [supplier](s_suppkey) WITH SAMPLE 100 PERCENT +GO \ No newline at end of file diff --git a/e2e-samples/tpc-samples/tpch/README.md b/e2e-samples/tpc-samples/tpch/README.md new file mode 100644 index 00000000..ad63c6a2 --- /dev/null +++ b/e2e-samples/tpc-samples/tpch/README.md @@ -0,0 +1 @@ +# TPCH setup scripts and queries \ No newline at end of file