add primary key support

This commit is contained in:
HSunboy 2019-11-15 11:01:55 +08:00
parent 2962271262
commit 02b00e17e0
10 changed files with 12234 additions and 11905 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1184,6 +1184,12 @@ sqlListener.prototype.enterDtColType = function (ctx) {
// Exit a parse tree produced by sqlParser#dtColType. // Exit a parse tree produced by sqlParser#dtColType.
sqlListener.prototype.exitDtColType = function (ctx) { sqlListener.prototype.exitDtColType = function (ctx) {
}; };
// Enter a parse tree produced by sqlParser#dtColIdentifier.
sqlListener.prototype.enterDtColIdentifier = function (ctx) {
};
// Exit a parse tree produced by sqlParser#dtColIdentifier.
sqlListener.prototype.exitDtColIdentifier = function (ctx) {
};
// Enter a parse tree produced by sqlParser#complexColTypeList. // Enter a parse tree produced by sqlParser#complexColTypeList.
sqlListener.prototype.enterComplexColTypeList = function (ctx) { sqlListener.prototype.enterComplexColTypeList = function (ctx) {
}; };

File diff suppressed because one or more lines are too long

View File

@ -792,6 +792,10 @@ sqlVisitor.prototype.visitDtColTypeList = function (ctx) {
sqlVisitor.prototype.visitDtColType = function (ctx) { sqlVisitor.prototype.visitDtColType = function (ctx) {
return this.visitChildren(ctx); return this.visitChildren(ctx);
}; };
// Visit a parse tree produced by sqlParser#dtColIdentifier.
sqlVisitor.prototype.visitDtColIdentifier = function (ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#complexColTypeList. // Visit a parse tree produced by sqlParser#complexColTypeList.
sqlVisitor.prototype.visitComplexColTypeList = function (ctx) { sqlVisitor.prototype.visitComplexColTypeList = function (ctx) {
return this.visitChildren(ctx); return this.visitChildren(ctx);

View File

@ -1,6 +1,6 @@
{ {
"name": "dt-sql-parser", "name": "dt-sql-parser",
"version": "2.0.6", "version": "2.0.7",
"description": "sql,hive,parser ", "description": "sql,hive,parser ",
"keywords": [ "keywords": [
"hive", "hive",

File diff suppressed because it is too large Load Diff

View File

@ -1775,6 +1775,15 @@ sqlListener.prototype.exitDtColType = function(ctx) {
}; };
// Enter a parse tree produced by sqlParser#dtColIdentifier.
sqlListener.prototype.enterDtColIdentifier = function(ctx) {
};
// Exit a parse tree produced by sqlParser#dtColIdentifier.
sqlListener.prototype.exitDtColIdentifier = function(ctx) {
};
// Enter a parse tree produced by sqlParser#complexColTypeList. // Enter a parse tree produced by sqlParser#complexColTypeList.
sqlListener.prototype.enterComplexColTypeList = function(ctx) { sqlListener.prototype.enterComplexColTypeList = function(ctx) {
}; };

File diff suppressed because one or more lines are too long

View File

@ -1188,6 +1188,12 @@ sqlVisitor.prototype.visitDtColType = function(ctx) {
}; };
// Visit a parse tree produced by sqlParser#dtColIdentifier.
sqlVisitor.prototype.visitDtColIdentifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by sqlParser#complexColTypeList. // Visit a parse tree produced by sqlParser#complexColTypeList.
sqlVisitor.prototype.visitComplexColTypeList = function(ctx) { sqlVisitor.prototype.visitComplexColTypeList = function(ctx) {
return this.visitChildren(ctx); return this.visitChildren(ctx);

View File

@ -156,5 +156,17 @@ describe('syntax test', () => {
const result = flinksqlParser(sql); const result = flinksqlParser(sql);
expect(result).toBeNull(); expect(result).toBeNull();
}) })
test('test primary key', () => {
const sql = `create table aa(
name.a[1].a varchar as name ,
ts int,
primary key (id, id[2])
) with (
type = 'kafka',
aa = '12'
);`;
const result = flinksqlParser(sql);
expect(result).toBeNull();
})
}) })
}) })