feat(flink): support insert multipe tables statement for FlinkSQL 1.15(#104)
* feat(flink): support insert multipe tables statement for FlinkSQL 1.15 * test: recover jest.config info * fix(flink): correct typo * fix(flinksql): resolve conflicts
This commit is contained in:
parent
4b824fb500
commit
c409b80ee1
@ -347,7 +347,8 @@ dropFunction
|
||||
// Insert statements
|
||||
|
||||
insertStatement
|
||||
: (KW_EXECUTE? insertSimpleStatement) | (KW_EXECUTE insertMulStatement)
|
||||
: (KW_EXECUTE? insertSimpleStatement)
|
||||
| insertMulStatementCompatibility | (KW_EXECUTE insertMulStatement)
|
||||
;
|
||||
|
||||
insertSimpleStatement
|
||||
@ -372,6 +373,10 @@ valuesRowDefinition
|
||||
RR_BRACKET
|
||||
;
|
||||
|
||||
insertMulStatementCompatibility
|
||||
: KW_BEGIN KW_STATEMENT KW_SET SEMICOLON (insertSimpleStatement SEMICOLON)+ KW_END
|
||||
;
|
||||
|
||||
insertMulStatement
|
||||
: KW_STATEMENT KW_SET KW_BEGIN (insertSimpleStatement SEMICOLON)+ KW_END
|
||||
;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/mortalYoung/Projects/dt-sql-parser/src/grammar/flinksql/FlinkSqlLexer.g4 by ANTLR 4.12.0
|
||||
// Generated from /Users/zhenglin/Documents/parser/dt-sql-parser/src/grammar/flinksql/FlinkSqlLexer.g4 by ANTLR 4.12.0
|
||||
// noinspection ES6UnusedImports,JSUnusedGlobalSymbols,JSUnusedLocalSymbols
|
||||
import {
|
||||
ATN,
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/mortalYoung/Projects/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
|
||||
// Generated from /Users/zhenglin/Documents/parser/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
|
||||
|
||||
import {ParseTreeListener} from "antlr4";
|
||||
|
||||
@ -81,6 +81,7 @@ import { InsertSimpleStatementContext } from "./FlinkSqlParser";
|
||||
import { InsertPartitionDefinitionContext } from "./FlinkSqlParser";
|
||||
import { ValuesDefinitionContext } from "./FlinkSqlParser";
|
||||
import { ValuesRowDefinitionContext } from "./FlinkSqlParser";
|
||||
import { InsertMulStatementCompatibilityContext } from "./FlinkSqlParser";
|
||||
import { InsertMulStatementContext } from "./FlinkSqlParser";
|
||||
import { QueryStatementContext } from "./FlinkSqlParser";
|
||||
import { ValuesCaluseContext } from "./FlinkSqlParser";
|
||||
@ -993,6 +994,16 @@ export default class FlinkSqlParserListener extends ParseTreeListener {
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitValuesRowDefinition?: (ctx: ValuesRowDefinitionContext) => void;
|
||||
/**
|
||||
* Enter a parse tree produced by `FlinkSqlParser.insertMulStatementCompatibility`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
enterInsertMulStatementCompatibility?: (ctx: InsertMulStatementCompatibilityContext) => void;
|
||||
/**
|
||||
* Exit a parse tree produced by `FlinkSqlParser.insertMulStatementCompatibility`.
|
||||
* @param ctx the parse tree
|
||||
*/
|
||||
exitInsertMulStatementCompatibility?: (ctx: InsertMulStatementCompatibilityContext) => void;
|
||||
/**
|
||||
* Enter a parse tree produced by `FlinkSqlParser.insertMulStatement`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Generated from /Users/mortalYoung/Projects/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
|
||||
// Generated from /Users/zhenglin/Documents/parser/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
|
||||
|
||||
import {ParseTreeVisitor} from 'antlr4';
|
||||
|
||||
@ -81,6 +81,7 @@ import { InsertSimpleStatementContext } from "./FlinkSqlParser";
|
||||
import { InsertPartitionDefinitionContext } from "./FlinkSqlParser";
|
||||
import { ValuesDefinitionContext } from "./FlinkSqlParser";
|
||||
import { ValuesRowDefinitionContext } from "./FlinkSqlParser";
|
||||
import { InsertMulStatementCompatibilityContext } from "./FlinkSqlParser";
|
||||
import { InsertMulStatementContext } from "./FlinkSqlParser";
|
||||
import { QueryStatementContext } from "./FlinkSqlParser";
|
||||
import { ValuesCaluseContext } from "./FlinkSqlParser";
|
||||
@ -682,6 +683,12 @@ export default class FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Resu
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitValuesRowDefinition?: (ctx: ValuesRowDefinitionContext) => Result;
|
||||
/**
|
||||
* Visit a parse tree produced by `FlinkSqlParser.insertMulStatementCompatibility`.
|
||||
* @param ctx the parse tree
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitInsertMulStatementCompatibility?: (ctx: InsertMulStatementCompatibilityContext) => Result;
|
||||
/**
|
||||
* Visit a parse tree produced by `FlinkSqlParser.insertMulStatement`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -10,7 +10,7 @@ export const readSQL = (dirname: string, fileName: string) => {
|
||||
const char = content[index];
|
||||
tmp += char;
|
||||
|
||||
const isMulti = tmp.includes('EXECUTE STATEMENT SET');
|
||||
const isMulti = tmp.includes('EXECUTE STATEMENT SET') || tmp.includes('BEGIN STATEMENT SET;');
|
||||
|
||||
if (!isMulti) {
|
||||
// 非批量的先简单按照分号切割
|
||||
|
@ -1,3 +1,5 @@
|
||||
-- FlinkSQL 1.16:insert multiple table statement
|
||||
|
||||
EXECUTE STATEMENT SET
|
||||
BEGIN
|
||||
INSERT INTO country_page_view
|
||||
@ -8,4 +10,13 @@ VALUES ('Chinese', 'mumiao', 18),
|
||||
('Amercian', 'georage', 22);
|
||||
END;
|
||||
|
||||
-- FlinkSQL 1.15:insert multiple table statement
|
||||
|
||||
BEGIN STATEMENT SET;
|
||||
INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
('Amercian', 'georage', 22);
|
||||
INSERT INTO country_page_view
|
||||
VALUES ('Chinese', 'mumiao', 18),
|
||||
('Amercian', 'georage', 22);
|
||||
END;
|
Loading…
Reference in New Issue
Block a user