博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pipelinedb Continuous transforms 操作
阅读量:6337 次
发布时间:2019-06-22

本文共 1886 字,大约阅读时间需要 6 分钟。

Continuous transforms 可以进行数据的转换,数据是不进行存储,主要是可以加入到其他的stream pipeline 中,或者写到其他外部

存储中,和存储过程结合使用,当前默认内置一个pipeline_stream_insert方便数据写入其他strem
注意不支持聚合操作

docker-compose

version: '3.6'services:  postgres:    image: pipelinedb/pipelinedb    ports:    - "5432:5432"

参考语法

CREATE CONTINUOUS TRANSFORM name AS query [ THEN EXECUTE PROCEDURE function_name ( arguments ) ]query 查询说明SELECT expression [ [ AS ] output_name ] [, ...]    [ FROM from_item [, ...] ]    [ WHERE condition ]    [ GROUP BY expression [, ...] ]where any expression in the SELECT statement can't contain an aggregate andfrom_item can be one of:    stream_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]    table_name [ [ AS ] alias [ ( column_alias [, ...] ) ] ]    from_item [ NATURAL ] join_type from_item [ ON join_condition ]

Continuous transforms 输出流

Continuous transforms 输出流,可以方便其他transforms或者Continuous view 读取

  • 参考
创建 CONTINUOUS TRANSFORMCREATE CONTINUOUS TRANSFORM t AS  SELECT t.y FROM some_stream s JOIN some_table t ON s.x = t.x;使用CREATE CONTINUOUS VIEW v AS  SELECT sum(y) FROM output_of('t');

参考例子

  • 创建两个stream
CREATE STREAM mystream3 (x integer, y integer);CREATE STREAM mystream4 (x integer, y integer);
  • 创建CONTINUOUS VIEW
CREATE CONTINUOUS VIEW v4 AS  SELECT x,y  FROM mystream3 ;CREATE CONTINUOUS VIEW v5 AS  SELECT x,y  FROM mystream4 ;
  • 创建CONTINUOUS TRANSFORM

    当insert 到mystream3 中的x为偶数的时候执行插入mystream4

CREATE CONTINUOUS TRANSFORM t3 AS  SELECT x::int, y::int FROM mystream3 WHERE mod(x, 2) = 0  THEN EXECUTE PROCEDURE pipeline_stream_insert('mystream4');
  • 数据插入&& 查询结果
    x 插入数据为1奇数
insert into mystream3(x,y) values(1,2);select * from v4;select * from v5;

x 插入数据为2奇数

insert into mystream3(x,y) values(2,5);select * from v4;select * from v5;

  • 使用CONTINUOUS TRANSFORM 的output steam
CREATE CONTINUOUS VIEW v6 AS  SELECT x,y  FROM output_of('t3') ;

插入数据&&查询

insert into mystream3(x,y) values(4,7);
select * from v6;

参考资料

 
 
 
 

转载地址:http://ydaoa.baihongyu.com/

你可能感兴趣的文章
为运维人员插上腾飞更远的翅膀!
查看>>
Word 2003中编辑标记与格式标记大讨论
查看>>
从国内向海外转移域名经验谈
查看>>
浅谈apache与tomact的整合
查看>>
SQL Server vNext CTP1 on Linux
查看>>
1-为 Lync Server 2010 准备 Active Directory 域服务
查看>>
NetBackup下ORACLE恢复测试方案实例解析
查看>>
【有奖征文】“失业”程序员的苦辣酸甜
查看>>
IE9是如何被FireFox4超越全球市场份额的?
查看>>
linux bunzip2命令
查看>>
敏捷个人:通过实践TOGAF来思考如何学习并应用新的方法?
查看>>
Android系统的开机画面显示过程分析(6)
查看>>
vivo Hi-Fi+QQ音乐 数字音乐市场的一剂良方
查看>>
Cocos2d-x 3.2 异步动态加载 -- 保卫萝卜开发总结
查看>>
聚焦触宝反侵权事件:中国创业者用什么护航海外市场大门
查看>>
AOP技术基础
查看>>
Android系统进程间通信(IPC)机制Binder中的Server启动过程源代码分析(2)
查看>>
无线802.11n 2.4G与5G性能测试
查看>>
子域名信息收集攻略
查看>>
[Android]开发数独游戏思路分析过程
查看>>