fix impala create table as select column bug

This commit is contained in:
HSunboy 2020-01-10 17:00:09 +08:00
parent 62aa00ebf1
commit 364dc5fcae
7 changed files with 4218 additions and 4201 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "dt-sql-parser", "name": "dt-sql-parser",
"version": "3.0.1", "version": "3.0.2",
"description": "sql,hive,parser ", "description": "sql,hive,parser ",
"keywords": [ "keywords": [
"hive", "hive",
@ -12,7 +12,7 @@
"scripts": { "scripts": {
"build:parse": "pegjs -o core/astParser.js peg/nquery.pegjs ", "build:parse": "pegjs -o core/astParser.js peg/nquery.pegjs ",
"build:filter": "pegjs -o core/comment.js peg/comment.pegjs ", "build:filter": "pegjs -o core/comment.js peg/comment.pegjs ",
"build:syntax": "sh ./jison/hue-sql-syntax.sh ", "build:syntax": "node ./src/scripts/generateParsers.js impala",
"build": "npm test && rm -rf lib && tsc", "build": "npm test && rm -rf lib && tsc",
"test": "jest" "test": "jest"
}, },

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -560,8 +560,14 @@ PartitionedBy
| 'PARTITION' 'BY' HashClauses | 'PARTITION' 'BY' HashClauses
| 'PARTITION' 'BY' HashClauses ',' RangeClause | 'PARTITION' 'BY' HashClauses ',' RangeClause
| 'PARTITION' 'BY' RangeClause | 'PARTITION' 'BY' RangeClause
| 'PARTITIONED' 'BY' '(' ColumnIdentifierList ')'
; ;
ColumnIdentifierList
: ColumnIdentifier ',' ColumnIdentifierList
| ColumnIdentifier
;
PartitionedBy_EDIT PartitionedBy_EDIT
: 'PARTITIONED' 'CURSOR' : 'PARTITIONED' 'CURSOR'
{ {

View File

@ -58,6 +58,17 @@ describe('syntax test', () => {
const result = parser.parseSyntax([sql, ''], dtSqlParser.parser.sqlType.Impala); const result = parser.parseSyntax([sql, ''], dtSqlParser.parser.sqlType.Impala);
expect(result).toBe(false); expect(result).toBe(false);
}) })
test('create as select', () => {
const sql = `create table partitions_yes partitioned by (year, month)
as select s, year, month from partitions_no;`
const result = parser.parseSyntax([sql, ''], dtSqlParser.parser.sqlType.Impala);
expect(result).toBe(false);
})
test('show grant ', () => {
const sql = `show grant role 18_112_a;`
const result = parser.parseSyntax([sql, ''], dtSqlParser.parser.sqlType.Impala);
expect(result).toBe(false);
})
}); });
describe('hive', () => { describe('hive', () => {
test('no error', () => { test('no error', () => {