Flink SQL Client
Flink’s Table & SQL API makes it possible to work with queries written in the SQL language, but these queries need to be embedded within a table program that is written in either Java or Scala. Moreover, these programs need to be packaged with a build tool before being submitted to a cluster. This more or less limits the usage of Flink to Java/Scala programmers.
The SQL Client aims to provide an easy way of writing, debugging, and submitting table programs to a Flink cluster without a single line of Java or Scala code. The SQL Client CLI allows for retrieving and visualizing real-time results from the running distributed application on the command line.
from https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/sqlClient.html
原文的大概意思是说Flink 提供的 Table 和 SQL 的接口先前只能通过用户编写程序的方式嵌入的使用, 对于定制化程度比较高的程序没什么问题,但是我们日常使用的大部分程序都比较简单,查询逻辑大量重复,所以提供一个SQL的专用客户端比较有意义。
其实这个就是类似 早期的Hive, Pig, 后来的SparkSQL这种,提供交互式的方式, 甚至作为一个SQL service独立 process [hiveserver2] (某种协议 thrift) 。 但是目前版本(1.12.1)都是提供embeded方式的,Flink 官方文档也列入了 SQL Client 部分的后期计划
Limitations & Future
The current SQL Client only supports embedded mode. In the future, the community plans to extend its functionality by providing a REST-based SQL Client Gateway, see more in FLIP-24 and FLIP-91.
from https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/table/sqlClient.html
但是无论如何,凭借着 Flink 处理架构的优越性 和 现在社区的火热, Flink SQL Client 还是未来可期待的 。
为什用SQL Client
前边文章说过了,当前公司X组内有一个 Ambari搭建的小型集群(其实是micro集群,😂),平时一些日常处理用内置的 HiveSQL也还可以,但是因为架构师规划用 Flink 重做一遍新的计算系统,调研时候顺便搞一下这里。其实本质上 Flink SQL 也继承了其基于Stream思想,设定的数据是 unbounded无边界的流,而且可以基于配置文件设计一个