PipelineDB:连续视图输出流意外显示相同(旧)和(新)值
PipelineDB: continuous view output stream unexpectedly shows same (old) and (new) values
我正在使用 PipelineDB 0.9.7u3
我尝试了一些连续视图输出流,看看是否可以通过一些更新获得新的连续视图。
这是我的测试用例。
CREATE STREAM stream_test(ticketid text, val int, status text);
-- simple continuous view on stream_test
CREATE CONTINUOUS VIEW cv_test AS
SELECT
ticketid,
min(val) as v0,
keyed_min(val, status) as v0_status
FROM stream_test
GROUP BY ticketid;
-- continuous view to keep cv_test's updates and insertions
CREATE CONTINUOUS VIEW cv_test_upin AS
SELECT
(new).ticketid,
(old).v0 as oldV0,
(old).v0_status as oldV0Status,
(new).v0 as newV0,
(new).v0_status as newV0Status
FROM output_of('cv_test')
-- continuous view to keep just some cv_test's updates
CREATE CONTINUOUS VIEW cv_test_up AS
SELECT
(new).ticketid,
(old).v0 as oldV0,
(old).v0_status as oldV0Status,
(new).v0 as newV0,
(new).v0_status as newV0Status
FROM output_of('cv_test')
WHERE (old).v0 != (new).v0;
让我们放一些数据。
INSERT INTO stream_test VALUES
('t1', 124, 'open'),
('t2', 190, 'pending')
正如预期的那样:
select * from cv_test;
"t2";190;"pending"
"t1";124;"open"
select * from cv_test_upin;
"t2";;"";190;"pending"
"t1";;"";124;"open"
select * from cv_test_up;
然后,一些更新。
INSERT INTO stream_test VALUES
('t2', 160, 'waiting'),
('t1', 100, 'pending')
正如预期的那样:
select * from cv_test;
"t2";160;"waiting"
"t1";100;"pending"
select * from cv_test_upin;
"t2";;"";190;"pending"
"t1";;"";124;"open"
"t2";190;"pending";160;"waiting"
"t1";124;"open";100;"pending"
select * from cv_test_up;
"t2";190;"pending";160;"waiting"
"t1";124;"open";100;"pending"
现在,一些新数据和一些更新。
INSERT INTO stream_test VALUES
('t2', 90, 'spam'),
('t3', 140, 'open'),
('t1', 80, 'closed')
select * from cv_test;
按预期返回,但 select * from cv_test_upin;
没有返回。
...
"t2";160;"waiting";90;"spam"
"t3";;"";140;"open"
"t1";80;"closed";80;"closed"
我预计最后 "t1" 是 "t1";100;"pending";80;"closed"
错误或预期行为?
谢谢。
在深入研究之后,您似乎确实发现了一些意想不到的行为,而且很可能是一个错误。我们很快就会解决它,这是问题所在:
https://github.com/pipelinedb/pipelinedb/issues/1797
解决后我们将发布更新版本。
我正在使用 PipelineDB 0.9.7u3
我尝试了一些连续视图输出流,看看是否可以通过一些更新获得新的连续视图。
这是我的测试用例。
CREATE STREAM stream_test(ticketid text, val int, status text);
-- simple continuous view on stream_test
CREATE CONTINUOUS VIEW cv_test AS
SELECT
ticketid,
min(val) as v0,
keyed_min(val, status) as v0_status
FROM stream_test
GROUP BY ticketid;
-- continuous view to keep cv_test's updates and insertions
CREATE CONTINUOUS VIEW cv_test_upin AS
SELECT
(new).ticketid,
(old).v0 as oldV0,
(old).v0_status as oldV0Status,
(new).v0 as newV0,
(new).v0_status as newV0Status
FROM output_of('cv_test')
-- continuous view to keep just some cv_test's updates
CREATE CONTINUOUS VIEW cv_test_up AS
SELECT
(new).ticketid,
(old).v0 as oldV0,
(old).v0_status as oldV0Status,
(new).v0 as newV0,
(new).v0_status as newV0Status
FROM output_of('cv_test')
WHERE (old).v0 != (new).v0;
让我们放一些数据。
INSERT INTO stream_test VALUES
('t1', 124, 'open'),
('t2', 190, 'pending')
正如预期的那样:
select * from cv_test;
"t2";190;"pending"
"t1";124;"open"
select * from cv_test_upin;
"t2";;"";190;"pending"
"t1";;"";124;"open"
select * from cv_test_up;
然后,一些更新。
INSERT INTO stream_test VALUES
('t2', 160, 'waiting'),
('t1', 100, 'pending')
正如预期的那样:
select * from cv_test;
"t2";160;"waiting"
"t1";100;"pending"
select * from cv_test_upin;
"t2";;"";190;"pending"
"t1";;"";124;"open"
"t2";190;"pending";160;"waiting"
"t1";124;"open";100;"pending"
select * from cv_test_up;
"t2";190;"pending";160;"waiting"
"t1";124;"open";100;"pending"
现在,一些新数据和一些更新。
INSERT INTO stream_test VALUES
('t2', 90, 'spam'),
('t3', 140, 'open'),
('t1', 80, 'closed')
select * from cv_test;
按预期返回,但 select * from cv_test_upin;
没有返回。
...
"t2";160;"waiting";90;"spam"
"t3";;"";140;"open"
"t1";80;"closed";80;"closed"
我预计最后 "t1" 是 "t1";100;"pending";80;"closed"
错误或预期行为?
谢谢。
在深入研究之后,您似乎确实发现了一些意想不到的行为,而且很可能是一个错误。我们很快就会解决它,这是问题所在:
https://github.com/pipelinedb/pipelinedb/issues/1797
解决后我们将发布更新版本。