You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Jingsong Li <ji...@gmail.com> on 2021/11/01 10:32:57 UTC
Re: Question about flink sql
Hi,
If you are using sql-client, you can try:
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/sqlclient/#execute-a-set-of-sql-statements
If you are using TableEnvironment, you can try statement set too:
https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/common/#translate-and-execute-a-query
Best,
Jingsong
On Fri, Oct 29, 2021 at 7:01 PM Jake <ft...@qq.com> wrote:
>
> Hi
>
> You can use like this:
>
> ```java
>
> val calciteParser = new CalciteParser(SqlUtil.getSqlParserConfig(tableEnv.getConfig))
> sqlArr
> .foreach(item => {
> println(item)
> val itemNode = calciteParser.parse(item)
>
> itemNode match {
> case sqlSet: SqlSet => {
> configuration.setString(sqlSet.getKeyString, sqlSet.getValueString)
> }
> case _: RichSqlInsert => insertSqlBuffer += item
> case _ => {
> println(item)
> val itemResult = tableEnv.executeSql(item)
> itemResult.print()
> }
> }
> })
>
> // execute batch inserts
> if (insertSqlBuffer.size > 0) {
> insertSqlBuffer.foreach(item => {
> println("insert sql: " + item)
> statementSet.addInsertSql(item)
> })
> val explain = statementSet.explain()
> println(explain)
> statementSet.execute()
> }
>
>
>
> ```
>
>
> On Oct 29, 2021, at 18:50, wx liao <li...@gmail.com> wrote:
>
> Hi:
> I use flink sql,and run a script that has one souce an two sink,I can see 2 jobs runing through webUI,is that normal?
> Can some way to ensure only run on job that has one source and two sink? Thank you
>
>
--
Best, Jingsong Lee