Regression tests cleanup to make tests repeat output less between tests (i.e. ioql_query does not repeat output from insert.sql)

This commit is contained in:
Matvey Arye 2017-01-06 12:41:00 -05:00
parent 74fe879150
commit e7faa8911a
15 changed files with 141 additions and 663 deletions

View File

@ -1,6 +1,6 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\ir include/create_clustered_db.sql
\set ECHO ALL
\c meta

View File

@ -1,18 +0,0 @@
DROP DATABASE IF EXISTS meta;
DROP DATABASE IF EXISTS "Test1";
DROP DATABASE IF EXISTS test2;
CREATE DATABASE meta;
CREATE DATABASE "Test1";
CREATE DATABASE test2;
\c meta
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_meta();
\c Test1
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_main();
\c test2
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_main();

View File

@ -1,7 +1,9 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\o /dev/null
\ir include/create_clustered_db.sql
\o
\set ECHO ALL
\c meta
SELECT add_cluster_user('postgres', NULL);

View File

@ -1,18 +1,3 @@
setup_meta
------------
(1 row)
setup_main
------------
(1 row)
setup_main
------------
(1 row)
\c meta
SELECT add_cluster_user('postgres', NULL);
add_cluster_user

View File

@ -1,13 +1,31 @@
\ir include/insert.sql
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
DROP DATABASE IF EXISTS meta;
DROP DATABASE IF EXISTS "Test1";
DROP DATABASE IF EXISTS test2;
CREATE DATABASE meta;
CREATE DATABASE "Test1";
CREATE DATABASE test2;
\c meta
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_meta();
setup_meta
------------
(1 row)
\c Test1
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_main();
setup_main
------------
(1 row)
\c test2
CREATE EXTENSION IF NOT EXISTS iobeamdb CASCADE;
select setup_main();
setup_main
------------

View File

@ -0,0 +1,103 @@
\c Test1
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs'));
json
-----------------------------------------------------------------------------------------------------------------------
{"timeCustom":1257987600000000000,"device_id":"dev1","series_0":1.5,"series_1":1,"series_2":null,"series_bool":null}
{"timeCustom":1257987600000000000,"device_id":"dev1","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257897600000000000,"device_id":"dev1","series_0":4.5,"series_1":5,"series_2":null,"series_bool":false}
{"timeCustom":1257894002000000000,"device_id":"dev1","series_0":2.5,"series_1":3,"series_2":null,"series_bool":null}
{"timeCustom":1257894001000000000,"device_id":"dev1","series_0":3.5,"series_1":4,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000001000,"device_id":"dev1","series_0":2.5,"series_1":3,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev2","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev1","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev2","series_0":1.5,"series_1":1,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev1","series_0":1.5,"series_1":1,"series_2":2,"series_bool":true}
(10 rows)
\set ON_ERROR_STOP 0
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'DoesNotExist'));
\set ON_ERROR_STOP 1
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT)
));
json
-------------------------------------------------
{"time":1257840000000000000,"sum(series_0)":22}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT),
limit_rows => 1
));
json
-------------------------------------------------
{"time":1257840000000000000,"sum(series_0)":22}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1')
));
json
---------------------------------------------------------------
{"series_1":3,"time":1257840000000000000,"sum(series_0)":5}
{"series_1":2,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":4,"time":1257840000000000000,"sum(series_0)":3.5}
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":5,"time":1257840000000000000,"sum(series_0)":4.5}
(5 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1'),
limit_rows => 1
));
json
---------------------------------------------------------------
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1'),
limit_time_periods => 1
));
json
---------------------------------------------------------------
{"series_1":3,"time":1257840000000000000,"sum(series_0)":5}
{"series_1":2,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":4,"time":1257840000000000000,"sum(series_0)":3.5}
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":5,"time":1257840000000000000,"sum(series_0)":4.5}
(5 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0')],
limit_by_field => new_limit_by_field('device_id', 1)
));
json
----------------------------------------------------------------------
{"timeCustom":1257987600000000000,"series_0":1.5,"device_id":"dev1"}
{"timeCustom":1257894000000000000,"series_0":1.5,"device_id":"dev2"}
(2 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0')],
limit_rows => 1
));
json
---------------------------------------------------
{"timeCustom":1257987600000000000,"series_0":1.5}
(1 row)

View File

@ -1,18 +1,3 @@
setup_meta
------------
(1 row)
setup_main
------------
(1 row)
setup_main
------------
(1 row)
setup_kafka
-------------

View File

@ -1,541 +0,0 @@
setup_meta
------------
(1 row)
setup_main
------------
(1 row)
setup_main
------------
(1 row)
\c meta
SELECT add_cluster_user('postgres', NULL);
add_cluster_user
------------------
(1 row)
SELECT set_meta('meta' :: NAME, 'localhost');
set_meta
----------
(1 row)
SELECT add_node('Test1' :: NAME, 'localhost');
add_node
----------
(1 row)
SELECT add_node('test2' :: NAME, 'localhost');
add_node
----------
(1 row)
\c Test1
CREATE TABLE PUBLIC."testNs" (
"timeCustom" BIGINT NOT NULL,
device_id TEXT NOT NULL,
series_0 DOUBLE PRECISION NULL,
series_1 DOUBLE PRECISION NULL,
series_2 DOUBLE PRECISION NULL,
series_bool BOOLEAN NULL
);
CREATE INDEX ON PUBLIC."testNs" (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
SELECT * FROM add_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'testNs' );
name | main_schema_name | main_table_name | associated_schema_name | associated_table_prefix | root_schema_name | root_table_name | distinct_schema_name | distinct_table_name | replication_factor | placement | time_field_name | time_field_type | created_on
--------+------------------+-----------------+------------------------+-------------------------+------------------+-----------------+----------------------+---------------------+--------------------+-----------+-----------------+-----------------+------------
testNs | public | testNs | testNs | _hyper_1 | testNs | _hyper_1_root | testNs | _hyper_1_distinct | 1 | STICKY | timeCustom | bigint | Test1
(1 row)
SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
set_is_distinct_flag
----------------------
(1 row)
\c Test1
BEGIN;
\COPY "testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
COMMIT;
SELECT close_chunk_end(c.id)
FROM get_open_partition_for_key('testNs', 'dev1') part
INNER JOIN chunk c ON (c.partition_id = part.id);
close_chunk_end
-----------------
(1 row)
\c Test1
BEGIN;
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257987600000000000, 'dev1', 1.5, 1),
(1257987600000000000, 'dev1', 1.5, 2),
(1257894002000000000, 'dev1', 2.5, 3);
COMMIT;
\c test2
BEGIN;
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257894000000000000, 'dev2', 1.5, 1),
(1257894000000000000, 'dev2', 1.5, 2);
COMMIT;
\c Test1
\d+ "testNs".*
Index "testNs.1-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (device_id IS NOT NULL)
Index "testNs.10-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_bool IS NOT NULL)
Index "testNs.2-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_0 IS NOT NULL)
Index "testNs.3-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_1 IS NOT NULL)
Index "testNs.4-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_2 IS NOT NULL)
Index "testNs.5-testNs_timeCustom_series_bool_idx"
Column | Type | Definition | Storage
-------------+---------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_bool | boolean | series_bool | plain
btree, for table "testNs._hyper_1_1_0_1_data", predicate (series_bool IS NOT NULL)
Index "testNs.6-testNs_device_id_timeCustom_idx"
Column | Type | Definition | Storage
------------+--------+--------------+----------
device_id | text | device_id | extended
timeCustom | bigint | "timeCustom" | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (device_id IS NOT NULL)
Index "testNs.7-testNs_timeCustom_series_0_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_0 | double precision | series_0 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_0 IS NOT NULL)
Index "testNs.8-testNs_timeCustom_series_1_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_1 | double precision | series_1 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_1 IS NOT NULL)
Index "testNs.9-testNs_timeCustom_series_2_idx"
Column | Type | Definition | Storage
------------+------------------+--------------+---------
timeCustom | bigint | "timeCustom" | plain
series_2 | double precision | series_2 | plain
btree, for table "testNs._hyper_1_1_0_2_data", predicate (series_2 IS NOT NULL)
Table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_0_1_distinct_data_pkey" PRIMARY KEY, btree (field, value)
Inherits: "testNs"._hyper_1_0_distinct
Index "testNs._hyper_1_0_1_distinct_data_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_0_1_distinct_data"
Table "testNs._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "testNs"._hyper_1_distinct
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"1-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
"2-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"3-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"4-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
"5-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257983999999999999'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_2_data"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Indexes:
"10-testNs_timeCustom_series_bool_idx" btree ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL
"6-testNs_device_id_timeCustom_idx" btree (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL
"7-testNs_timeCustom_series_0_idx" btree ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL
"8-testNs_timeCustom_series_1_idx" btree ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL
"9-testNs_timeCustom_series_2_idx" btree ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257984000000000000'::bigint)
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_1_0_1_data,
"testNs"._hyper_1_1_0_2_data
Table "testNs._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Table "testNs._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "testNs"._hyper_1_0_distinct
Index "testNs._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_distinct"
Table "testNs._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Child tables: "testNs"._hyper_1_0_replica
\c test2
\d+ "testNs".*
Foreign table "testNs._hyper_1_0_1_distinct_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
--------+------+-----------+-------------+----------+--------------+-------------
field | text | not null | | extended | |
value | text | not null | | extended | |
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_0_1_distinct_data')
Inherits: "testNs"._hyper_1_0_distinct
Table "testNs._hyper_1_0_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Inherits: "testNs"._hyper_1_distinct
Child tables: "testNs"._hyper_1_0_1_distinct_data
Table "testNs._hyper_1_0_replica"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Inherits: "testNs"._hyper_1_root
Child tables: "testNs"._hyper_1_1_0_partition,
"testNs"._hyper_1_2_0_partition
Foreign table "testNs._hyper_1_1_0_1_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
timeCustom | bigint | not null | | plain | |
device_id | text | not null | | extended | |
series_0 | double precision | | | plain | |
series_1 | double precision | | | plain | |
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" <= '1257983999999999999'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_1_data')
Inherits: "testNs"._hyper_1_1_0_partition
Foreign table "testNs._hyper_1_1_0_2_data"
Column | Type | Modifiers | FDW Options | Storage | Stats target | Description
-------------+------------------+-----------+-------------+----------+--------------+-------------
timeCustom | bigint | not null | | plain | |
device_id | text | not null | | extended | |
series_0 | double precision | | | plain | |
series_1 | double precision | | | plain | |
series_2 | double precision | | | plain | |
series_bool | boolean | | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
"time_range" CHECK ("timeCustom" >= '1257984000000000000'::bigint)
Server: Test1
FDW Options: (schema_name 'testNs', table_name '_hyper_1_1_0_2_data')
Inherits: "testNs"._hyper_1_1_0_partition
Table "testNs._hyper_1_1_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '0'::smallint AND get_partition_for_key(device_id, 32768) <= '16383'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Child tables: "testNs"._hyper_1_1_0_1_data,
"testNs"._hyper_1_1_0_2_data
Table "testNs._hyper_1_2_0_partition"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Check constraints:
"partition" CHECK (get_partition_for_key(device_id, 32768) >= '16384'::smallint AND get_partition_for_key(device_id, 32768) <= '32767'::smallint)
Inherits: "testNs"._hyper_1_0_replica
Table "testNs._hyper_1_distinct"
Column | Type | Modifiers | Storage | Stats target | Description
--------+------+-----------+----------+--------------+-------------
field | text | not null | extended | |
value | text | not null | extended | |
Indexes:
"_hyper_1_distinct_pkey" PRIMARY KEY, btree (field, value)
Child tables: "testNs"._hyper_1_0_distinct
Index "testNs._hyper_1_distinct_pkey"
Column | Type | Definition | Storage
--------+------+------------+----------
field | text | field | extended
value | text | value | extended
primary key, btree, for table "testNs._hyper_1_distinct"
Table "testNs._hyper_1_root"
Column | Type | Modifiers | Storage | Stats target | Description
-------------+------------------+-----------+----------+--------------+-------------
timeCustom | bigint | not null | plain | |
device_id | text | not null | extended | |
series_0 | double precision | | plain | |
series_1 | double precision | | plain | |
series_2 | double precision | | plain | |
series_bool | boolean | | plain | |
Child tables: "testNs"._hyper_1_0_replica
SELECT *
FROM "testNs"._hyper_1_0_replica;
timeCustom | device_id | series_0 | series_1 | series_2 | series_bool
---------------------+-----------+----------+----------+----------+-------------
1257894000000000000 | dev1 | 1.5 | 1 | 2 | t
1257894000000000000 | dev1 | 1.5 | 2 | |
1257894000000001000 | dev1 | 2.5 | 3 | |
1257894001000000000 | dev1 | 3.5 | 4 | |
1257897600000000000 | dev1 | 4.5 | 5 | | f
1257894002000000000 | dev1 | 2.5 | 3 | |
1257894000000000000 | dev2 | 1.5 | 1 | |
1257894000000000000 | dev2 | 1.5 | 2 | |
1257987600000000000 | dev1 | 1.5 | 1 | |
1257987600000000000 | dev1 | 1.5 | 2 | |
(10 rows)
SELECT *
FROM "testNs"._hyper_1_0_distinct;
field | value
-----------+-------
device_id | dev1
device_id | dev2
(2 rows)
\c Test1
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs'));
json
-----------------------------------------------------------------------------------------------------------------------
{"timeCustom":1257987600000000000,"device_id":"dev1","series_0":1.5,"series_1":1,"series_2":null,"series_bool":null}
{"timeCustom":1257987600000000000,"device_id":"dev1","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257897600000000000,"device_id":"dev1","series_0":4.5,"series_1":5,"series_2":null,"series_bool":false}
{"timeCustom":1257894002000000000,"device_id":"dev1","series_0":2.5,"series_1":3,"series_2":null,"series_bool":null}
{"timeCustom":1257894001000000000,"device_id":"dev1","series_0":3.5,"series_1":4,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000001000,"device_id":"dev1","series_0":2.5,"series_1":3,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev2","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev1","series_0":1.5,"series_1":2,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev2","series_0":1.5,"series_1":1,"series_2":null,"series_bool":null}
{"timeCustom":1257894000000000000,"device_id":"dev1","series_0":1.5,"series_1":1,"series_2":2,"series_bool":true}
(10 rows)
\set ON_ERROR_STOP 0
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'DoesNotExist'));
\set ON_ERROR_STOP 1
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT)
));
json
-------------------------------------------------
{"time":1257840000000000000,"sum(series_0)":22}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT),
limit_rows => 1
));
json
-------------------------------------------------
{"time":1257840000000000000,"sum(series_0)":22}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1')
));
json
---------------------------------------------------------------
{"series_1":3,"time":1257840000000000000,"sum(series_0)":5}
{"series_1":2,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":4,"time":1257840000000000000,"sum(series_0)":3.5}
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":5,"time":1257840000000000000,"sum(series_0)":4.5}
(5 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1'),
limit_rows => 1
));
json
---------------------------------------------------------------
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
(1 row)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0', 'SUM')],
aggregate => new_aggregate((100 * 60 * 60 * 1e9) :: BIGINT, 'series_1'),
limit_time_periods => 1
));
json
---------------------------------------------------------------
{"series_1":3,"time":1257840000000000000,"sum(series_0)":5}
{"series_1":2,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":4,"time":1257840000000000000,"sum(series_0)":3.5}
{"series_1":1,"time":1257840000000000000,"sum(series_0)":4.5}
{"series_1":5,"time":1257840000000000000,"sum(series_0)":4.5}
(5 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0')],
limit_by_field => new_limit_by_field('device_id', 1)
));
json
----------------------------------------------------------------------
{"timeCustom":1257987600000000000,"series_0":1.5,"device_id":"dev1"}
{"timeCustom":1257894000000000000,"series_0":1.5,"device_id":"dev2"}
(2 rows)
SELECT *
FROM ioql_exec_query(new_ioql_query(namespace_name => 'testNs',
select_items => ARRAY [new_select_item('series_0')],
limit_rows => 1
));
json
---------------------------------------------------
{"timeCustom":1257987600000000000,"series_0":1.5}
(1 row)

View File

@ -1,18 +1,3 @@
setup_meta
------------
(1 row)
setup_main
------------
(1 row)
setup_main
------------
(1 row)
\c meta
SELECT add_cluster_user('postgres', NULL);
add_cluster_user

View File

@ -1,7 +1,9 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\o /dev/null
\ir include/create_clustered_db.sql
\o
\c meta
\ir ../../setup/sql/load_common.sql
\ir ../../setup/sql/load_meta.sql

View File

@ -1,58 +1,7 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\set ECHO ALL
\c meta
SELECT add_cluster_user('postgres', NULL);
SELECT set_meta('meta' :: NAME, 'localhost');
SELECT add_node('Test1' :: NAME, 'localhost');
SELECT add_node('test2' :: NAME, 'localhost');
\c Test1
CREATE TABLE PUBLIC."testNs" (
"timeCustom" BIGINT NOT NULL,
device_id TEXT NOT NULL,
series_0 DOUBLE PRECISION NULL,
series_1 DOUBLE PRECISION NULL,
series_2 DOUBLE PRECISION NULL,
series_bool BOOLEAN NULL
);
CREATE INDEX ON PUBLIC."testNs" (device_id, "timeCustom" DESC NULLS LAST) WHERE device_id IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_0) WHERE series_0 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_1) WHERE series_1 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_2) WHERE series_2 IS NOT NULL;
CREATE INDEX ON PUBLIC."testNs" ("timeCustom" DESC NULLS LAST, series_bool) WHERE series_bool IS NOT NULL;
SELECT * FROM add_hypertable('"public"."testNs"', 'timeCustom', 'device_id', hypertable_name=>'testNs', associated_schema_name=>'testNs' );
SELECT set_is_distinct_flag('"public"."testNs"', 'device_id', TRUE);
\c Test1
BEGIN;
\COPY "testNs" FROM 'data/ds1_dev1_1.tsv' NULL AS '';
COMMIT;
SELECT close_chunk_end(c.id)
FROM get_open_partition_for_key('testNs', 'dev1') part
INNER JOIN chunk c ON (c.partition_id = part.id);
\c Test1
BEGIN;
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257987600000000000, 'dev1', 1.5, 1),
(1257987600000000000, 'dev1', 1.5, 2),
(1257894002000000000, 'dev1', 2.5, 3);
COMMIT;
\c test2
BEGIN;
INSERT INTO "testNs"("timeCustom", device_id, series_0, series_1) VALUES
(1257894000000000000, 'dev2', 1.5, 1),
(1257894000000000000, 'dev2', 1.5, 2);
COMMIT;
\ir include/insert.sql
\c Test1
\d+ "testNs".*

View File

@ -1,7 +1,10 @@
\set ON_ERROR_STOP 1
\ir insert.sql
\o /dev/null
\ir include/insert.sql
\o
\set ECHO ALL
\c Test1
SELECT *

View File

@ -1,6 +1,9 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\o /dev/null
\ir include/create_clustered_db.sql
\o
\c Test1
\ir ../../setup/sql/load_kafka.sql
select setup_kafka();

View File

@ -26,7 +26,7 @@ rm -fr actual/*
golden_test cluster.sql cluster.out
golden_test kafka.sql kafka.out
golden_test insert.sql insert.out
golden_test query.sql query.out
golden_test ioql_query.sql ioql_query.out
golden_test ddl.sql ddl.out
golden_test timestamp.sql timestamp.out
echo "Success"

View File

@ -1,7 +1,9 @@
\set ON_ERROR_STOP 1
\ir create_clustered_db.sql
\o /dev/null
\ir include/create_clustered_db.sql
\o
\set ECHO ALL
\c meta
SELECT add_cluster_user('postgres', NULL);