目录

  • 一、目标
  • 二、方案
    • 2.1、 自己实现demo:
    • 2.2、 社区实现:

一、目标

希望使用flink sql来关联维度表,但是想用异步IO的方式关联。

二、方案

当前社区进展:目前Flink SQL 中的connector都没实现异步io关联维表,但是接口是已经支持了的,可以自定义实现;HBase connector 社区有人正在支持异步io关联维表,预计1.13可以使用。

2.1、 自己实现demo:
    /*** An async lookup function which find matched rows with the given fields. NOTE: We have to* declare it as public because it will be used in code generation.*/public static class AsyncTestValueLookupFunction extends AsyncTableFunction<Row> {private static final long serialVersionUID = 1L;private final Map<Row, List<Row>> mapping;private transient boolean isOpenCalled = false;private transient ExecutorService executor;protected AsyncTestValueLookupFunction(Map<Row, List<Row>> mapping) {this.mapping = mapping;}@Overridepublic void open(FunctionContext context) throws Exception {RESOURCE_COUNTER.incrementAndGet();isOpenCalled = true;executor = Executors.newSingleThreadExecutor();}public void eval(CompletableFuture<Collection<Row>> resultFuture, Object... inputs) {checkArgument(isOpenCalled, "open() is not called.");final Row key = Row.of(inputs);if (Arrays.asList(inputs).contains(null)) {throw new IllegalArgumentException(String.format("Lookup key %s contains null value, which should not happen.",key));}CompletableFuture.supplyAsync(() -> {List<Row> list = mapping.get(key);if (list == null) {return Collections.<Row>emptyList();} else {return list;}},executor).thenAccept(resultFuture::complete);}@Overridepublic void close() throws Exception {RESOURCE_COUNTER.decrementAndGet();if (executor != null && !executor.isShutdown()) {executor.shutdown();}}}
2.2、 社区实现:

https://github.com/apache/flink/pull/14684#pullrequestreview-604148209

Flink SQL中使用异步io关联维表相关推荐

  1. Flink(54):Flink高级特性之异步IO(Async I/O)

    目录 0. 相关文章链接 1. 异步IO概述 1.1. 异步IO操作的需求 1.2. 使用Aysnc I/O的前提条件 1.3. Async I/O API 2. 案例展示 2.1. 需求 2.2. ...

  2. linux 内核io操作,关于Linux内核中的异步IO的使用

    我们都知道异步IO的作用,就是可以提高我们程序的并发能力,尤其在网络模型中.在linux中有aio的一系列异步IO的函数接口,但是这类函数都是glibc库中的函数,是基于多线程实现,不是真正的异步IO ...

  3. python 异步io_Python中的异步IO:完整的演练

    python 异步io Async IO is a concurrent programming design that has received dedicated support in Pytho ...

  4. 【Flink】Flink 源码阅读笔记(18)- Flink SQL 中的流和动态表

    1.概述 转载:Flink 源码阅读笔记(18)- Flink SQL 中的流和动态表

  5. Flink SQL中的函数

    Table API是内嵌在Java语言中的,很多方法需要在类中额外添加,扩展功能比较麻烦,目前支持的函数比较少,故一般情况下我们使用Flink SQL中的函数 Flink SQL中的函数主要分为两类: ...

  6. flink sql 如何upsert 到一张hologres表中

    Flink Table 的三种 Sink 模式 作为计算引擎 Flink 应用的计算结果总要以某种方式输出,比如调试阶段的打印到控制台或者生产阶段的写到数据库.而对于本来就需要在 Flink 内存保存 ...

  7. KNIME中使用Unpivoting将二维表转为一维表

    出现问题 因为是中文数据,使用CSV READER读取后出现乱码,同时Unpivoting中也出现乱码. 在该NOTE中设置字符: 原始数据 原表数据,从图中可以看出是二维表,不利于数据分析,目标是保 ...

  8. Fink异步IO的实战(关联维表)

    简介 异步io实战 知识前提 线程池异步io 应用程序 public class ASyncIODemo {public static void main(String[] args) throws ...

  9. flink批处理访问mysql_Flink 异步IO访问外部数据(mysql篇)

    最近看了大佬的博客,突然想起Async I/O方式是Blink 推给社区的一大重要功能,可以使用异步的方式获取外部数据,想着自己实现以下,项目上用的时候,可以不用现去找了. 最开始想用scala 实现 ...

最新文章

  1. LinkedIn招聘推荐系统中的机器学习的威力
  2. 不同配置决定不同的复制的流程
  3. BZOJ 1412 [ZJOI2009]狼和羊的故事(最小割)
  4. “新内容 新交互”全球视频云创新挑战赛复赛启幕
  5. Android 6.0 超级简单的权限申请2 (Permission)
  6. pb通过对象名称调用对象_域服务是命名空间,利用AD DS,通过对象名称可找到相关所有信息...
  7. linux100day(day4)--文本处理三剑客
  8. JS组件系列——Bootstrap 树控件使用经验分享 - 懒得安分 - 博客园
  9. 32岁被裁补偿N+2:“感谢裁我,让我翻倍!” 网友:求同款被裁!
  10. 执行计划中cpu耗时_面试被问怎么排查遇到的系统CPU飙高和频繁GC,到底该怎么回答?...
  11. 【Flink】Flink1.12.0 FlinkSQL消费Kafka 使用 temporal join 关联维表Hive 最新分区数据 join 不上
  12. Linux链接文件、管道、重定向讲解
  13. java jxls_java使用jxls导出Excel
  14. Kopernio插件+SCI-HUB最新可用网址
  15. 迅为iTOP-4418开发板烧写 Android 7.1 镜像
  16. 中国的美女为什么这样少的原因
  17. Linux /dev/mapper/ubuntu--vg-ubuntu--lv 磁盘空间不足的问题
  18. 【slowfast中ava数据集处理】ava数据集,将原视频裁剪为15分钟每段
  19. java开发任务必备的工具_Web常用开发工具有哪些?常用工具推荐
  20. 微软宣布2011年4月发布Windows 7 SP1

热门文章

  1. Linux / Windows Subsystem for Linux (WSL) 安装 ADB (Android Debug Bridge,Android 调试桥)
  2. Java常用到的6个加密技术,先收藏,总会用得到
  3. OpenHarmony3.1适配移远EC20模组4G上网功能
  4. python的类,实例,以及实例化
  5. 详解卷积中的Winograd加速算法
  6. SQL日志文件查看工具(Log Explorer for SQL Server v4.2)
  7. java判断数据库是否存在_java判断数据库是否存在的方法
  8. 大数据hadoop环境部署
  9. 基于Android自习室占座座位管理系统
  10. C#中使用SHA1算法对密码进行加密