Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create test cases for upgrading compatibility validation #560

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
-- Create Indexes
-- B-tree
CREATE INDEX btree_idx_sales_heap_1 ON sales_heap(product_id);
CREATE INDEX btree_idx_sales_heap_2 ON sales_heap(customer_name);
CREATE INDEX btree_idx_sales_ao_1 ON sales_ao(product_id);
CREATE INDEX btree_idx_sales_ao_2 ON sales_ao(customer_name);
CREATE INDEX btree_idx_sales_aocs_1 ON sales_aocs(product_id);
CREATE INDEX btree_idx_sales_aocs_2 ON sales_aocs(product_id, sale_date);
CREATE INDEX btree_idx_sales_partition_heap_1 ON sales_partition_heap(product_id);
CREATE INDEX btree_idx_sales_partition_heap_2 ON sales_partition_heap(customer_name);
CREATE INDEX btree_idx_sales_partition_ao_1 ON sales_partition_ao(product_id);
CREATE INDEX btree_idx_sales_partition_ao_2 ON sales_partition_ao(product_id, sale_date);
CREATE INDEX btree_idx_sales_partition_ao_3 ON sales_partition_ao(customer_name);
CREATE INDEX btree_idx_sales_partition_aocs1 ON sales_partition_aocs(product_id);
CREATE INDEX btree_idx_sales_partition_aocs2 ON sales_partition_aocs(customer_name, product_id);
-- Unique
CREATE UNIQUE INDEX on sales_ao(product_id);
CREATE UNIQUE INDEX on sales_aocs(product_id,description);
CREATE UNIQUE INDEX on sales_partition_ao(product_id,order_date);
-- CREATE UNIQUE INDEX on sales_partition_aocs(product_id,description); blocked by issue #557
-- Bitmap
CREATE INDEX bmp_idx_sales_ao ON sales_ao USING bitmap(is_audited);
CREATE INDEX bmp_idx_sales_partition_aocs ON sales_partition_aocs USING bitmap(status);
CREATE INDEX bmp_idx_sales_heap ON sales_heap USING bitmap(status);
-- Brin
-- CREATE INDEX brin_idx_sales_ao ON sales_ao USING brin (sale_date) with (pages_per_range = 1); blocked by issue #558
CREATE INDEX brin_idx_sales_partition_heap ON sales_partition_heap USING brin (sale_date) with (pages_per_range = 1);
-- CREATE INDEX brin_idx_sales_aocs ON sales_aocs USING brin (sale_date) with (pages_per_range = 1); blocked by issue #558
182 changes: 182 additions & 0 deletions src/test/binary_swap/expected/upgrading_compatibility/create_table.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
-- Create various types of tables for migration compatibility test
--
-- List of tables in Summary
-- Name | Type | Partition by | Storage
------------------------------+-------------------+--------------+----------------------
-- sales_ao | table | | append only
-- sales_aocs | table | | append only columnar
-- sales_heap | table | | heap
-- sales_partition_ao | partitioned table | range |
-- sales_partition_aocs | partitioned table | hash |
-- sales_partition_heap | partitioned table | list |
-- sales_partition_ao_part1 | table | | append only
-- sales_partition_ao_part2 | table | | append only
-- sales_partition_ao_part3 | table | | append only
-- sales_partition_aocs_part1 | table | | append only columnar
-- sales_partition_aocs_part2 | table | | append only columnar
-- sales_partition_aocs_part3 | table | | append only columnar
-- sales_partition_heap_part1 | table | | heap
-- sales_partition_heap_part2 | table | | heap
-- sales_partition_heap_part3 | table | | heap
--
-- Heap Table
DROP TABLE IF EXISTS sales_heap;
NOTICE: table "sales_heap" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_heap
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
DISTRIBUTED BY (product_id);
-- Heap Table, Partition by LIST
DROP TABLE IF EXISTS sales_partition_heap;
NOTICE: table "sales_partition_heap" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_partition_heap
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
DISTRIBUTED BY (product_id)
PARTITION BY LIST (status);
CREATE TABLE sales_partition_heap_part1
PARTITION OF sales_partition_heap
FOR VALUES IN ('Cancelled');
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_heap_part2
PARTITION OF sales_partition_heap
FOR VALUES IN ('Closed');
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_heap_part3
PARTITION OF sales_partition_heap
FOR VALUES IN ('Processing');
NOTICE: table has parent, setting distribution columns to match parent table
-- AO Table
DROP TABLE IF EXISTS sales_ao;
NOTICE: table "sales_ao" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_ao
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
WITH (appendonly=true)
DISTRIBUTED BY (product_id);
-- AO Table, Partition by Range
DROP TABLE IF EXISTS sales_partition_ao;
NOTICE: table "sales_partition_ao" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_partition_ao
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
DISTRIBUTED BY (product_id)
PARTITION BY RANGE (order_date);
CREATE TABLE sales_partition_ao_part1
PARTITION OF sales_partition_ao
FOR VALUES FROM ('2023-01-01') TO ('2024-01-01')
WITH (appendonly=true);
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_ao_part2
PARTITION OF sales_partition_ao
FOR VALUES FROM ('2024-01-01') TO ('2025-01-01')
WITH (appendonly=true);
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_ao_part3
PARTITION OF sales_partition_ao
FOR VALUES FROM ('2025-01-01') TO ('2026-01-01')
WITH (appendonly=true);
NOTICE: table has parent, setting distribution columns to match parent table
-- AOCS Table
DROP TABLE IF EXISTS sales_aocs;
NOTICE: table "sales_aocs" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_aocs
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
WITH (appendonly=true, orientation=column)
DISTRIBUTED BY (product_id);
-- AOCS Table, Partition by Hash
DROP TABLE IF EXISTS sales_partition_aocs;
NOTICE: table "sales_partition_aocs" does not exist, skipping
CREATE TABLE IF NOT EXISTS sales_partition_aocs
(
product_id INT,
is_audited BOOLEAN DEFAULT FALSE,
quantity SMALLINT,
total_sales BIGINT,
unit_price REAL,
discount DOUBLE PRECISION,
description TEXT,
sale_date TIMESTAMP,
order_date DATE,
status CHAR(10),
customer_name VARCHAR(20),
price DECIMAL(20, 10)
)
DISTRIBUTED BY (product_id)
PARTITION BY HASH(description);
CREATE TABLE sales_partition_aocs_part1
PARTITION OF sales_partition_aocs
FOR VALUES WITH (MODULUS 3, REMAINDER 0)
WITH (appendonly=true, orientation=column);
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_aocs_part2
PARTITION OF sales_partition_aocs
FOR VALUES WITH (MODULUS 3, REMAINDER 1)
WITH (appendonly=true, orientation=column);
NOTICE: table has parent, setting distribution columns to match parent table
CREATE TABLE sales_partition_aocs_part3
PARTITION OF sales_partition_aocs
FOR VALUES WITH (MODULUS 3, REMAINDER 2)
WITH (appendonly=true, orientation=column);
NOTICE: table has parent, setting distribution columns to match parent table
42 changes: 42 additions & 0 deletions src/test/binary_swap/expected/upgrading_compatibility/delete.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
DELETE FROM sales_heap WHERE product_id > 1000000;
DELETE FROM sales_ao WHERE product_id > 1000000;
DELETE FROM sales_aocs WHERE product_id > 1000000;
DELETE FROM sales_partition_heap WHERE product_id > 1000000;
DELETE FROM sales_partition_ao WHERE product_id > 1000000;
DELETE FROM sales_partition_aocs WHERE product_id > 1000000;
SELECT COUNT(*) FROM sales_heap;
count
-------
10000
(1 row)

SELECT COUNT(*) FROM sales_ao;
count
-------
10000
(1 row)

SELECT COUNT(*) FROM sales_aocs;
count
-------
10000
(1 row)

SELECT COUNT(*) FROM sales_partition_heap;
count
-------
10000
(1 row)

SELECT COUNT(*) FROM sales_partition_ao;
count
-------
10000
(1 row)

SELECT COUNT(*) FROM sales_partition_aocs;
count
-------
10000
(1 row)

Loading
Loading