mirror of https://github.com/citusdata/citus.git
remove generated sql test files
parent
be5a586843
commit
1b45cfb52e
|
@ -1,73 +0,0 @@
|
|||
--
|
||||
-- Test block filtering in cstore_fdw using min/max values in stripe skip lists.
|
||||
--
|
||||
|
||||
|
||||
--
|
||||
-- filtered_row_count returns number of rows filtered by the WHERE clause.
|
||||
-- If blocks get filtered by cstore_fdw, less rows are passed to WHERE
|
||||
-- clause, so this function should return a lower number.
|
||||
--
|
||||
CREATE OR REPLACE FUNCTION filtered_row_count (query text) RETURNS bigint AS
|
||||
$$
|
||||
DECLARE
|
||||
result bigint;
|
||||
rec text;
|
||||
BEGIN
|
||||
result := 0;
|
||||
|
||||
FOR rec IN EXECUTE 'EXPLAIN ANALYZE ' || query LOOP
|
||||
IF rec ~ '^\s+Rows Removed by Filter' then
|
||||
result := regexp_replace(rec, '[^0-9]*', '', 'g');
|
||||
END IF;
|
||||
END LOOP;
|
||||
|
||||
RETURN result;
|
||||
END;
|
||||
$$ LANGUAGE PLPGSQL;
|
||||
|
||||
|
||||
-- Create and load data
|
||||
-- block_row_count '1000', stripe_row_count '2000'
|
||||
set cstore.stripe_row_count = 2000;
|
||||
set cstore.block_row_count = 1000;
|
||||
CREATE TABLE test_block_filtering (a int)
|
||||
USING cstore_tableam;
|
||||
|
||||
COPY test_block_filtering FROM '/Users/jefdavi/wd/cstore2/data/block_filtering.csv' WITH CSV;
|
||||
|
||||
|
||||
-- Verify that filtered_row_count is less than 1000 for the following queries
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a < 200');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a > 200');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a < 9900');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a > 9900');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a < 0');
|
||||
|
||||
|
||||
-- Verify that filtered_row_count is less than 2000 for the following queries
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a BETWEEN 1 AND 10');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a BETWEEN 990 AND 2010');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a BETWEEN -10 AND 0');
|
||||
|
||||
|
||||
-- Load data for second time and verify that filtered_row_count is exactly twice as before
|
||||
COPY test_block_filtering FROM '/Users/jefdavi/wd/cstore2/data/block_filtering.csv' WITH CSV;
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a < 200');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a < 0');
|
||||
SELECT filtered_row_count('SELECT count(*) FROM test_block_filtering WHERE a BETWEEN 990 AND 2010');
|
||||
|
||||
set cstore.stripe_row_count to default;
|
||||
set cstore.block_row_count to default;
|
||||
|
||||
-- Verify that we are fine with collations which use a different alphabet order
|
||||
CREATE TABLE collation_block_filtering_test(A text collate "da_DK")
|
||||
USING cstore_tableam;
|
||||
COPY collation_block_filtering_test FROM STDIN;
|
||||
A
|
||||
Å
|
||||
B
|
||||
\.
|
||||
|
||||
SELECT * FROM collation_block_filtering_test WHERE A > 'B';
|
|
@ -1,17 +0,0 @@
|
|||
--
|
||||
-- Test copying data from cstore_fdw tables.
|
||||
--
|
||||
CREATE TABLE test_contestant(handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
|
||||
-- load table data from file
|
||||
COPY test_contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
||||
|
||||
-- export using COPY table TO ...
|
||||
COPY test_contestant TO STDOUT;
|
||||
|
||||
-- export using COPY (SELECT * FROM table) TO ...
|
||||
COPY (select * from test_contestant) TO STDOUT;
|
||||
|
||||
DROP TABLE test_contestant CASCADE;
|
|
@ -1,20 +0,0 @@
|
|||
--
|
||||
-- Test the CREATE statements related to cstore.
|
||||
--
|
||||
|
||||
|
||||
-- Create uncompressed table
|
||||
CREATE TABLE contestant (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
|
||||
|
||||
-- Create compressed table with automatically determined file path
|
||||
-- COMPRESSED
|
||||
CREATE TABLE contestant_compressed (handle TEXT, birthdate DATE, rating INT,
|
||||
percentile FLOAT, country CHAR(3), achievements TEXT[])
|
||||
USING cstore_tableam;
|
||||
|
||||
-- Test that querying an empty table works
|
||||
ANALYZE contestant;
|
||||
SELECT count(*) FROM contestant;
|
|
@ -1,68 +0,0 @@
|
|||
--
|
||||
-- Test loading and reading different data types to/from cstore_fdw foreign tables.
|
||||
--
|
||||
|
||||
|
||||
-- Settings to make the result deterministic
|
||||
SET datestyle = "ISO, YMD";
|
||||
SET timezone to 'GMT';
|
||||
SET intervalstyle TO 'POSTGRES_VERBOSE';
|
||||
|
||||
|
||||
-- Test array types
|
||||
CREATE TABLE test_array_types (int_array int[], bigint_array bigint[],
|
||||
text_array text[]) USING cstore_tableam;
|
||||
|
||||
COPY test_array_types FROM '/Users/jefdavi/wd/cstore2/data/array_types.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_array_types;
|
||||
|
||||
|
||||
-- Test date/time types
|
||||
CREATE TABLE test_datetime_types (timestamp timestamp,
|
||||
timestamp_with_timezone timestamp with time zone, date date, time time,
|
||||
interval interval) USING cstore_tableam;
|
||||
|
||||
COPY test_datetime_types FROM '/Users/jefdavi/wd/cstore2/data/datetime_types.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_datetime_types;
|
||||
|
||||
|
||||
-- Test enum and composite types
|
||||
CREATE TYPE enum_type AS ENUM ('a', 'b', 'c');
|
||||
CREATE TYPE composite_type AS (a int, b text);
|
||||
|
||||
CREATE TABLE test_enum_and_composite_types (enum enum_type,
|
||||
composite composite_type) USING cstore_tableam;
|
||||
|
||||
COPY test_enum_and_composite_types FROM
|
||||
'/Users/jefdavi/wd/cstore2/data/enum_and_composite_types.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_enum_and_composite_types;
|
||||
|
||||
|
||||
-- Test range types
|
||||
CREATE TABLE test_range_types (int4range int4range, int8range int8range,
|
||||
numrange numrange, tsrange tsrange) USING cstore_tableam;
|
||||
|
||||
COPY test_range_types FROM '/Users/jefdavi/wd/cstore2/data/range_types.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_range_types;
|
||||
|
||||
|
||||
-- Test other types
|
||||
CREATE TABLE test_other_types (bool boolean, bytea bytea, money money,
|
||||
inet inet, bitstring bit varying(5), uuid uuid, json json) USING cstore_tableam;
|
||||
|
||||
COPY test_other_types FROM '/Users/jefdavi/wd/cstore2/data/other_types.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_other_types;
|
||||
|
||||
|
||||
-- Test null values
|
||||
CREATE TABLE test_null_values (a int, b int[], c composite_type)
|
||||
USING cstore_tableam;
|
||||
|
||||
COPY test_null_values FROM '/Users/jefdavi/wd/cstore2/data/null_values.csv' WITH CSV;
|
||||
|
||||
SELECT * FROM test_null_values;
|
|
@ -1,46 +0,0 @@
|
|||
--
|
||||
-- Test loading data into cstore_fdw tables.
|
||||
--
|
||||
|
||||
-- COPY with incorrect delimiter
|
||||
COPY contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv'
|
||||
WITH DELIMITER '|'; -- ERROR
|
||||
|
||||
-- COPY with invalid program
|
||||
COPY contestant FROM PROGRAM 'invalid_program' WITH CSV; -- ERROR
|
||||
|
||||
-- COPY into uncompressed table from file
|
||||
COPY contestant FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
||||
|
||||
-- COPY into uncompressed table from program
|
||||
COPY contestant FROM PROGRAM 'cat /Users/jefdavi/wd/cstore2/data/contestants.2.csv' WITH CSV;
|
||||
|
||||
-- COPY into compressed table
|
||||
set cstore.compression = 'pglz';
|
||||
COPY contestant_compressed FROM '/Users/jefdavi/wd/cstore2/data/contestants.1.csv' WITH CSV;
|
||||
|
||||
-- COPY into uncompressed table from program
|
||||
COPY contestant_compressed FROM PROGRAM 'cat /Users/jefdavi/wd/cstore2/data/contestants.2.csv'
|
||||
WITH CSV;
|
||||
set cstore.compression to default;
|
||||
|
||||
-- Test column list
|
||||
CREATE TABLE famous_constants (id int, name text, value real)
|
||||
USING cstore_tableam;
|
||||
COPY famous_constants (value, name, id) FROM STDIN WITH CSV;
|
||||
3.141,pi,1
|
||||
2.718,e,2
|
||||
0.577,gamma,3
|
||||
5.291e-11,bohr radius,4
|
||||
\.
|
||||
|
||||
COPY famous_constants (name, value) FROM STDIN WITH CSV;
|
||||
avagadro,6.022e23
|
||||
electron mass,9.109e-31
|
||||
proton mass,1.672e-27
|
||||
speed of light,2.997e8
|
||||
\.
|
||||
|
||||
SELECT * FROM famous_constants ORDER BY id, name;
|
||||
|
||||
DROP TABLE famous_constants;
|
Loading…
Reference in New Issue