mirror of https://github.com/citusdata/citus.git
commit
41f98f9c02
|
@ -78,16 +78,17 @@ ORDER BY x;
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
END;
|
END;
|
||||||
|
-- don't print the worker port
|
||||||
|
\set VERBOSITY terse
|
||||||
-- files should now be cleaned up
|
-- files should now be cleaned up
|
||||||
SELECT x, x2
|
SELECT x, x2
|
||||||
FROM interesting_squares JOIN (SELECT * FROM read_intermediate_result('squares', 'binary') AS res (x text, x2 int)) squares ON (x = interested_in)
|
FROM interesting_squares JOIN (SELECT * FROM read_intermediate_result('squares', 'binary') AS res (x text, x2 int)) squares ON (x = interested_in)
|
||||||
WHERE user_id = 'jon'
|
WHERE user_id = 'jon'
|
||||||
ORDER BY x;
|
ORDER BY x;
|
||||||
WARNING: result "squares" does not exist
|
WARNING: result "squares" does not exist
|
||||||
CONTEXT: while executing command on localhost:57638
|
|
||||||
WARNING: result "squares" does not exist
|
WARNING: result "squares" does not exist
|
||||||
CONTEXT: while executing command on localhost:57637
|
|
||||||
ERROR: could not receive query results
|
ERROR: could not receive query results
|
||||||
|
\set VERBOSITY DEFAULT
|
||||||
-- try to read the file as text, will fail because of binary encoding
|
-- try to read the file as text, will fail because of binary encoding
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT create_intermediate_result('squares', 'SELECT s, s*s FROM generate_series(1,5) s');
|
SELECT create_intermediate_result('squares', 'SELECT s, s*s FROM generate_series(1,5) s');
|
||||||
|
|
|
@ -32,11 +32,11 @@ SELECT COUNT(*) FROM limit_orders_mx WHERE id = 32745;
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
-- and see all the inserted rows
|
-- and see all the inserted rows
|
||||||
SELECT * FROM limit_orders_mx;
|
SELECT * FROM limit_orders_mx ORDER BY 1;
|
||||||
id | symbol | bidder_id | placed_at | kind | limit_price
|
id | symbol | bidder_id | placed_at | kind | limit_price
|
||||||
-------+--------+-----------+--------------------------+------+-------------
|
-------+--------+-----------+--------------------------+------+-------------
|
||||||
32744 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
|
||||||
32743 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
32743 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
||||||
|
32744 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
||||||
32745 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
32745 | AAPL | 9580 | Tue Oct 19 10:23:54 2004 | buy | 20.69
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
|
|
|
@ -422,7 +422,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
user_id > 2 AND user_id < 6
|
user_id > 2 AND user_id < 6
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
user_id | value_1 | array_agg | array_agg
|
user_id | value_1 | array_agg | array_agg
|
||||||
---------+---------+-------------------------------------------------------+-----------------------------------------------------
|
---------+---------+-------------------------------------------------------+-----------------------------------------------------
|
||||||
3 | 0 | {0} |
|
3 | 0 | {0} |
|
||||||
|
@ -507,7 +507,7 @@ WINDOW
|
||||||
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
user_id | value_1 | array_agg | array_agg
|
user_id | value_1 | array_agg | array_agg
|
||||||
---------+---------+---------------------------------------+-------------------------------------
|
---------+---------+---------------------------------------+-------------------------------------
|
||||||
3 | 0 | {0,1,1,1,1,1,1} | {1,1,1,1,1,1}
|
3 | 0 | {0,1,1,1,1,1,1} | {1,1,1,1,1,1}
|
||||||
|
@ -592,40 +592,40 @@ WINDOW
|
||||||
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
user_id | value_1 | array_agg | array_agg
|
user_id | value_1 | array_agg | array_agg
|
||||||
---------+---------+-----------+-----------
|
---------+---------+-----------+-----------
|
||||||
3 | 0 | {0,1} | {1}
|
3 | 0 | {0,1} | {1}
|
||||||
3 | 1 | {1,1,1} | {1,1}
|
|
||||||
3 | 1 | {1,1,2} | {1,2}
|
|
||||||
3 | 1 | {0,1,1} | {0,1}
|
3 | 1 | {0,1,1} | {0,1}
|
||||||
3 | 1 | {1,1,1} | {1,1}
|
3 | 1 | {1,1,1} | {1,1}
|
||||||
3 | 1 | {1,1,1} | {1,1}
|
3 | 1 | {1,1,1} | {1,1}
|
||||||
3 | 1 | {1,1,1} | {1,1}
|
3 | 1 | {1,1,1} | {1,1}
|
||||||
|
3 | 1 | {1,1,1} | {1,1}
|
||||||
|
3 | 1 | {1,1,2} | {1,2}
|
||||||
3 | 2 | {1,2,2} | {1,2}
|
3 | 2 | {1,2,2} | {1,2}
|
||||||
3 | 2 | {2,2,3} | {2,3}
|
3 | 2 | {2,2,3} | {2,3}
|
||||||
3 | 3 | {2,3,3} | {2,3}
|
3 | 3 | {2,3,3} | {2,3}
|
||||||
3 | 3 | {3,3,4} | {3,4}
|
|
||||||
3 | 3 | {3,3,3} | {3,3}
|
3 | 3 | {3,3,3} | {3,3}
|
||||||
3 | 4 | {4,4,4} | {4,4}
|
3 | 3 | {3,3,4} | {3,4}
|
||||||
3 | 4 | {4,4,4} | {4,4}
|
|
||||||
3 | 4 | {3,4,4} | {3,4}
|
3 | 4 | {3,4,4} | {3,4}
|
||||||
|
3 | 4 | {4,4,4} | {4,4}
|
||||||
|
3 | 4 | {4,4,4} | {4,4}
|
||||||
3 | 4 | {4,4,5} | {4,5}
|
3 | 4 | {4,4,5} | {4,5}
|
||||||
3 | 5 | {4,5} | {4}
|
3 | 5 | {4,5} | {4}
|
||||||
4 | 0 | {0,0,1} | {0,1}
|
|
||||||
4 | 0 | {0,0,0} | {0,0}
|
|
||||||
4 | 0 | {0,0} | {0}
|
4 | 0 | {0,0} | {0}
|
||||||
4 | 0 | {0,0,0} | {0,0}
|
4 | 0 | {0,0,0} | {0,0}
|
||||||
|
4 | 0 | {0,0,0} | {0,0}
|
||||||
|
4 | 0 | {0,0,1} | {0,1}
|
||||||
4 | 1 | {0,1,2} | {0,2}
|
4 | 1 | {0,1,2} | {0,2}
|
||||||
4 | 2 | {2,2,3} | {2,3}
|
|
||||||
4 | 2 | {2,2,2} | {2,2}
|
|
||||||
4 | 2 | {1,2,2} | {1,2}
|
4 | 2 | {1,2,2} | {1,2}
|
||||||
4 | 3 | {3,3,4} | {3,4}
|
4 | 2 | {2,2,2} | {2,2}
|
||||||
4 | 3 | {3,3,3} | {3,3}
|
4 | 2 | {2,2,3} | {2,3}
|
||||||
4 | 3 | {3,3,3} | {3,3}
|
|
||||||
4 | 3 | {3,3,3} | {3,3}
|
|
||||||
4 | 3 | {3,3,3} | {3,3}
|
|
||||||
4 | 3 | {2,3,3} | {2,3}
|
4 | 3 | {2,3,3} | {2,3}
|
||||||
|
4 | 3 | {3,3,3} | {3,3}
|
||||||
|
4 | 3 | {3,3,3} | {3,3}
|
||||||
|
4 | 3 | {3,3,3} | {3,3}
|
||||||
|
4 | 3 | {3,3,3} | {3,3}
|
||||||
|
4 | 3 | {3,3,4} | {3,4}
|
||||||
4 | 4 | {3,4,4} | {3,4}
|
4 | 4 | {3,4,4} | {3,4}
|
||||||
4 | 4 | {4,4,4} | {4,4}
|
4 | 4 | {4,4,4} | {4,4}
|
||||||
4 | 4 | {4,4,4} | {4,4}
|
4 | 4 | {4,4,4} | {4,4}
|
||||||
|
@ -633,34 +633,34 @@ ORDER BY
|
||||||
4 | 4 | {4,4,4} | {4,4}
|
4 | 4 | {4,4,4} | {4,4}
|
||||||
4 | 4 | {4,4,4} | {4,4}
|
4 | 4 | {4,4,4} | {4,4}
|
||||||
4 | 4 | {4,4,5} | {4,5}
|
4 | 4 | {4,4,5} | {4,5}
|
||||||
4 | 5 | {5,5} | {5}
|
|
||||||
4 | 5 | {4,5,5} | {4,5}
|
4 | 5 | {4,5,5} | {4,5}
|
||||||
5 | 0 | {0,0,1} | {0,1}
|
4 | 5 | {5,5} | {5}
|
||||||
5 | 0 | {0,0} | {0}
|
5 | 0 | {0,0} | {0}
|
||||||
|
5 | 0 | {0,0,1} | {0,1}
|
||||||
|
5 | 1 | {0,1,1} | {0,1}
|
||||||
5 | 1 | {1,1,1} | {1,1}
|
5 | 1 | {1,1,1} | {1,1}
|
||||||
5 | 1 | {1,1,2} | {1,2}
|
5 | 1 | {1,1,2} | {1,2}
|
||||||
5 | 1 | {0,1,1} | {0,1}
|
|
||||||
5 | 2 | {2,2,2} | {2,2}
|
|
||||||
5 | 2 | {1,2,2} | {1,2}
|
5 | 2 | {1,2,2} | {1,2}
|
||||||
|
5 | 2 | {2,2,2} | {2,2}
|
||||||
|
5 | 2 | {2,2,2} | {2,2}
|
||||||
|
5 | 2 | {2,2,2} | {2,2}
|
||||||
|
5 | 2 | {2,2,2} | {2,2}
|
||||||
5 | 2 | {2,2,3} | {2,3}
|
5 | 2 | {2,2,3} | {2,3}
|
||||||
5 | 2 | {2,2,2} | {2,2}
|
|
||||||
5 | 2 | {2,2,2} | {2,2}
|
|
||||||
5 | 2 | {2,2,2} | {2,2}
|
|
||||||
5 | 3 | {3,3,4} | {3,4}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {3,3,3} | {3,3}
|
|
||||||
5 | 3 | {2,3,3} | {2,3}
|
5 | 3 | {2,3,3} | {2,3}
|
||||||
5 | 4 | {4,4,5} | {4,5}
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
5 | 4 | {4,4,4} | {4,4}
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,3} | {3,3}
|
||||||
|
5 | 3 | {3,3,4} | {3,4}
|
||||||
5 | 4 | {3,4,4} | {3,4}
|
5 | 4 | {3,4,4} | {3,4}
|
||||||
|
5 | 4 | {4,4,4} | {4,4}
|
||||||
|
5 | 4 | {4,4,5} | {4,5}
|
||||||
|
5 | 5 | {4,5,5} | {4,5}
|
||||||
5 | 5 | {5,5} | {5}
|
5 | 5 | {5,5} | {5}
|
||||||
5 | 5 | {5,5,5} | {5,5}
|
5 | 5 | {5,5,5} | {5,5}
|
||||||
5 | 5 | {4,5,5} | {4,5}
|
|
||||||
(66 rows)
|
(66 rows)
|
||||||
|
|
||||||
-- some tests with GROUP BY, HAVING and LIMIT
|
-- some tests with GROUP BY, HAVING and LIMIT
|
||||||
|
|
|
@ -422,7 +422,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
user_id > 2 AND user_id < 6
|
user_id > 2 AND user_id < 6
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
ERROR: syntax error at or near "EXCLUDE"
|
ERROR: syntax error at or near "EXCLUDE"
|
||||||
LINE 5: ...ANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE CU...
|
LINE 5: ...ANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW EXCLUDE CU...
|
||||||
^
|
^
|
||||||
|
@ -440,7 +440,7 @@ WINDOW
|
||||||
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
ERROR: RANGE PRECEDING is only supported with UNBOUNDED
|
ERROR: RANGE PRECEDING is only supported with UNBOUNDED
|
||||||
LINE 11: ..._window as (PARTITION BY user_id ORDER BY value_1 RANGE BETW...
|
LINE 11: ..._window as (PARTITION BY user_id ORDER BY value_1 RANGE BETW...
|
||||||
^
|
^
|
||||||
|
@ -458,7 +458,7 @@ WINDOW
|
||||||
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
ERROR: syntax error at or near "EXCLUDE"
|
ERROR: syntax error at or near "EXCLUDE"
|
||||||
LINE 12: ...value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CU...
|
LINE 12: ...value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CU...
|
||||||
^
|
^
|
||||||
|
|
|
@ -38,12 +38,17 @@ JOIN (SELECT * FROM read_intermediate_result('squares', 'binary') AS res (x int,
|
||||||
ORDER BY x;
|
ORDER BY x;
|
||||||
END;
|
END;
|
||||||
|
|
||||||
|
-- don't print the worker port
|
||||||
|
\set VERBOSITY terse
|
||||||
|
|
||||||
-- files should now be cleaned up
|
-- files should now be cleaned up
|
||||||
SELECT x, x2
|
SELECT x, x2
|
||||||
FROM interesting_squares JOIN (SELECT * FROM read_intermediate_result('squares', 'binary') AS res (x text, x2 int)) squares ON (x = interested_in)
|
FROM interesting_squares JOIN (SELECT * FROM read_intermediate_result('squares', 'binary') AS res (x text, x2 int)) squares ON (x = interested_in)
|
||||||
WHERE user_id = 'jon'
|
WHERE user_id = 'jon'
|
||||||
ORDER BY x;
|
ORDER BY x;
|
||||||
|
|
||||||
|
\set VERBOSITY DEFAULT
|
||||||
|
|
||||||
-- try to read the file as text, will fail because of binary encoding
|
-- try to read the file as text, will fail because of binary encoding
|
||||||
BEGIN;
|
BEGIN;
|
||||||
SELECT create_intermediate_result('squares', 'SELECT s, s*s FROM generate_series(1,5) s');
|
SELECT create_intermediate_result('squares', 'SELECT s, s*s FROM generate_series(1,5) s');
|
||||||
|
|
|
@ -24,7 +24,7 @@ INSERT INTO limit_orders_mx VALUES (32745, 'AAPL', 9580, '2004-10-19 10:23:54',
|
||||||
SELECT COUNT(*) FROM limit_orders_mx WHERE id = 32745;
|
SELECT COUNT(*) FROM limit_orders_mx WHERE id = 32745;
|
||||||
|
|
||||||
-- and see all the inserted rows
|
-- and see all the inserted rows
|
||||||
SELECT * FROM limit_orders_mx;
|
SELECT * FROM limit_orders_mx ORDER BY 1;
|
||||||
|
|
||||||
-- basic single-row INSERT with RETURNING
|
-- basic single-row INSERT with RETURNING
|
||||||
INSERT INTO limit_orders_mx VALUES (32746, 'AAPL', 9580, '2004-10-19 10:23:54', 'buy', 20.69) RETURNING *;
|
INSERT INTO limit_orders_mx VALUES (32746, 'AAPL', 9580, '2004-10-19 10:23:54', 'buy', 20.69) RETURNING *;
|
||||||
|
|
|
@ -239,7 +239,7 @@ FROM
|
||||||
WHERE
|
WHERE
|
||||||
user_id > 2 AND user_id < 6
|
user_id > 2 AND user_id < 6
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
|
|
||||||
-- test <offset> preceding and <offset> following on RANGE window
|
-- test <offset> preceding and <offset> following on RANGE window
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -255,7 +255,7 @@ WINDOW
|
||||||
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
range_window as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
range_window_exclude as (PARTITION BY user_id ORDER BY value_1 RANGE BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
|
|
||||||
-- test <offset> preceding and <offset> following on ROW window
|
-- test <offset> preceding and <offset> following on ROW window
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -271,7 +271,7 @@ WINDOW
|
||||||
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
row_window as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING),
|
||||||
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
row_window_exclude as (PARTITION BY user_id ORDER BY value_1 ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING EXCLUDE CURRENT ROW)
|
||||||
ORDER BY
|
ORDER BY
|
||||||
user_id, value_1;
|
user_id, value_1, 3, 4;
|
||||||
|
|
||||||
-- some tests with GROUP BY, HAVING and LIMIT
|
-- some tests with GROUP BY, HAVING and LIMIT
|
||||||
SELECT
|
SELECT
|
||||||
|
|
Loading…
Reference in New Issue