test: hiveSQL test units of index
This commit is contained in:
parent
ebd9a1ed85
commit
f1ca0738d3
@ -15,6 +15,6 @@ describe('Hive SQL Syntax Tests', () => {
|
|||||||
test('Wrong Select Statement', () => {
|
test('Wrong Select Statement', () => {
|
||||||
const sql = 'SELECT add ABC FROM WHERE;';
|
const sql = 'SELECT add ABC FROM WHERE;';
|
||||||
const result = parser.validate(sql);
|
const result = parser.validate(sql);
|
||||||
expect(result.length).toBe(2);
|
expect(result.length).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
18
test/parser/hive/syntax/alterStatement.test.ts
Normal file
18
test/parser/hive/syntax/alterStatement.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import HiveSQL from '../../../../src/parser/hive';
|
||||||
|
import { readSQL } from '../../../helper';
|
||||||
|
|
||||||
|
const parser = new HiveSQL();
|
||||||
|
|
||||||
|
const features = {
|
||||||
|
indexes: readSQL(__dirname, 'alterIndex.sql'),
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Hive Alter Syntax Tests', () => {
|
||||||
|
describe('ALTER INDEX', () => {
|
||||||
|
features.indexes.forEach((index) => {
|
||||||
|
it(index, () => {
|
||||||
|
expect(parser.validate(index).length).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -56,13 +56,13 @@ describe('Hive Create Syntax Tests', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// describe('CREATE INDEX', () => {
|
describe('CREATE INDEX', () => {
|
||||||
// features.indexes.forEach((index) => {
|
features.indexes.forEach((index) => {
|
||||||
// it(index, () => {
|
it(index, () => {
|
||||||
// expect(parser.validate(index).length).toBe(0);
|
expect(parser.validate(index).length).toBe(0);
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
// });
|
});
|
||||||
|
|
||||||
describe('CREATE MACRO', () => {
|
describe('CREATE MACRO', () => {
|
||||||
features.macros.forEach((macro) => {
|
features.macros.forEach((macro) => {
|
||||||
|
18
test/parser/hive/syntax/dropStatement.test.ts
Normal file
18
test/parser/hive/syntax/dropStatement.test.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import HiveSQL from '../../../../src/parser/hive';
|
||||||
|
import { readSQL } from '../../../helper';
|
||||||
|
|
||||||
|
const parser = new HiveSQL();
|
||||||
|
|
||||||
|
const features = {
|
||||||
|
indexes: readSQL(__dirname, 'dropIndex.sql'),
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('Hive Drop Syntax Tests', () => {
|
||||||
|
describe('DROP INDEX', () => {
|
||||||
|
features.indexes.forEach((index) => {
|
||||||
|
it(index, () => {
|
||||||
|
expect(parser.validate(index).length).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
3
test/parser/hive/syntax/fixtures/alterIndex.sql
Normal file
3
test/parser/hive/syntax/fixtures/alterIndex.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
ALTER INDEX table01_index ON table01
|
||||||
|
PARTITION (pt1, pt2 = '2019-04-01')
|
||||||
|
REBUILD;
|
@ -16,9 +16,9 @@ TBLPROPERTIES ("prop1"="value1", "prop2"="value2");
|
|||||||
CREATE INDEX table04_index
|
CREATE INDEX table04_index
|
||||||
ON TABLE table04 (column5)
|
ON TABLE table04 (column5)
|
||||||
AS 'COMPACT'
|
AS 'COMPACT'
|
||||||
|
IDXPROPERTIES ("prop3"="value3", "prop4"="value4")
|
||||||
IN TABLE indextable1
|
IN TABLE indextable1
|
||||||
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler';
|
STORED BY 'org.apache.hadoop.hive.hbase.HBaseStorageHandler';
|
||||||
IDXPROPERTIES ("prop3"="value3", "prop4"="value4");
|
|
||||||
|
|
||||||
CREATE INDEX table05_index
|
CREATE INDEX table05_index
|
||||||
ON TABLE table05 (column6)
|
ON TABLE table05 (column6)
|
||||||
@ -30,7 +30,3 @@ ON TABLE table06 (column7)
|
|||||||
AS 'COMPACT'
|
AS 'COMPACT'
|
||||||
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
|
ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'
|
||||||
STORED AS TEXTFILE;
|
STORED AS TEXTFILE;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
3
test/parser/hive/syntax/fixtures/dropIndex.sql
Normal file
3
test/parser/hive/syntax/fixtures/dropIndex.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
DROP INDEX table01_index ON table01;
|
||||||
|
|
||||||
|
DROP INDEX IF EXISTS table02_index ON table02;
|
Loading…
Reference in New Issue
Block a user