[ 
https://issues.apache.org/jira/browse/FLINK-11965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16797286#comment-16797286
 ] 

chenminghua edited comment on FLINK-11965 at 3/20/19 3:54 PM:
--------------------------------------------------------------

Timo Walther,Thank you for your attention!

 

my general idea of implementation is as follows:

By Extend “RestServerEndpoint” and “SimpleChannelInboundHandler” (which is in 
“Flink Runtime REST” module) realize the REST’s network layer.

using Antlr Implement a simple sql interpreter,the sql interpreter  interpretes 
The SQL statements  and generate “TableEntry”, “ViewEntry”, “dml”.

Add a method (“createEnvironmentInstance(List<TableEntry> tables, 
List<ViewEntry> views, int parallelism)”) to “ExecutionContex” that implements 
registry “TableEntry” and “ViewEntry” to "TableEnvireonment”."REST Handler" 
registers "TableEntry" and "ViewEntry" generated by "sql interpreter" to 
"TableEnvireonment" with this new method.Then "REST Handler "updates 
"TableEnvireonment" with "DML SQL" and create "JobGraph" then submits the job 
to the Flink cluster with "ProgramDeployer".


was (Author: chenminghua):
Timo Walther,Thank you for your attention!

 

my general idea of implementation is as follows:

By Extend “RestServerEndpoint” and “SimpleChannelInboundHandler” (which is in 
“Flink Runtime REST” module) realize the REST’s network layer.

using Antlr Implement an sql interpreter,the sql interpreter  interpretes The 
SQL statements  and generate “TableEntry”, “ViewEntry”, “dml”.

Add a method (“createEnvironmentInstance(List<TableEntry> tables, 
List<ViewEntry> views, int parallelism)”) to “ExecutionContex” that implements 
registry “TableEntry” and “ViewEntry” to "TableEnvireonment”."REST Handler" 
registers "TableEntry" and "ViewEntry" generated by "sql interpreter" to 
"TableEnvireonment" with this new method.Then "REST Handler "updates 
"TableEnvireonment" with "DML SQL" and create "JobGraph" then submits the job 
to the Flink cluster with "ProgramDeployer".

> Provide a REST API for flink to submit plain SQL flink jobs.
> ------------------------------------------------------------
>
>                 Key: FLINK-11965
>                 URL: https://issues.apache.org/jira/browse/FLINK-11965
>             Project: Flink
>          Issue Type: Improvement
>          Components: SQL / Client
>            Reporter: chenminghua
>            Priority: Major
>
> SQL Client has been able to use Flink with SQL without the need to write Java 
> or Scala programs, avoiding tedious compilation and packaging work.However, 
> SQL Client is used in Command-Line Interface (CLI), which is not convenient 
> for remote application access. In addition, SQL Client must define 
> sourceTable and sinkTable in yaml file and submit a job to flink cluster for 
> each SQL statement processed.For a slightly more complex stream program is 
> not easy to achieve through SQL Client.Therefore, it is necessary to provide 
> a REST API for flink to submit plain SQL flink jobs.
> The SQL jobs REST API 
> include:/job/submit、/job/list、/job/stop、/job/restart。Where "/job/submit" is 
> used to submit the SQL job, and its parameters are passed through the JSON 
> request.The JSON request looks like this: {color:#FF0000}{"name":"myJob", 
> "statements":"CREATE TABLE userTable (user BIGINT, message VARCHAR) WITH(type 
> source, update-mode append, connector.type kafka, connector.version 0.10, 
> connector.topic test-user, connector.startup-mode earliest-offset, 
> connector.properties.0.key zookeeper.connect, connector.properties.0.value 
> zkHost:2181/kafka_2_1_0, connector.properties.1.key bootstrap.servers, 
> connector.properties.1.value kafkaHost:9099, format.type json, 
> format.fail-on-missing-field true, format.derive-schema true); CREATE TABLE 
> targetUserTable (user BIGINT, message VARCHAR) WITH(type sink, ……); CREATE 
> APPEND VIEW appView SELECT user, message FROM userTable group by user, 
> message; INSERT into targetUserTable SELECT user, message FROM 
> appView;”}{color}.name is the name of the job. statements  is the contents of 
> a job, which contains multiple SQL statements(Support create table…., create 
> view….., create append view….., insert into….. several types of SQL 
> statements).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to