|
|
@@ -61,7 +61,7 @@ define([
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['DATABASE', 'EXTERNAL TABLE', 'FUNCTION', 'INDEX', 'ROLE', 'SCHEMA', 'TABLE', 'TEMPORARY EXTERNAL TABLE', 'TEMPORARY FUNCTION', 'TEMPORARY TABLE', 'VIEW']
|
|
|
+ suggestKeywords: ['DATABASE', 'EXTERNAL TABLE', 'FUNCTION', 'INDEX', 'ROLE', 'SCHEMA', 'TABLE', 'TEMPORARY EXTERNAL TABLE', 'TEMPORARY FUNCTION', 'TEMPORARY MACRO', 'TEMPORARY TABLE', 'VIEW']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
@@ -179,2124 +179,2215 @@ define([
|
|
|
})
|
|
|
});
|
|
|
|
|
|
- describe('CREATE TABLE', function () {
|
|
|
- it('should suggest keywords for "CREATE TABLE |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['IF NOT EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE TABLE IF |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE IF ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['NOT EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE TABLE IF NOT |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE IF NOT ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should handle for "CREATE TABLE foo (id INT);|"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id INT);',
|
|
|
- afterCursor: '',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id ',
|
|
|
- afterCursor: '',
|
|
|
- containsKeywords: ['BOOLEAN'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id INT, some FLOAT, bar |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id INT, some FLOAT, bar ',
|
|
|
- afterCursor: '',
|
|
|
- containsKeywords: ['BOOLEAN'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
+ describe('CREATE FUNCTION', function () {
|
|
|
+ describe('Hive specific', function () {
|
|
|
+ it('should handle "CREATE TEMPORARY FUNCTION baaa AS \'boo.baa\'; |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TEMPORARY FUNCTION baaa AS \'boo.baa\'; ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- describe('Impala specific', function () {
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL |"', function () {
|
|
|
+ it('should handle "CREATE FUNCTION boo.baaa AS \'boo.baa\' USING JAR \'boo.jar\', FILE \'booo\', ARCHIVE \'baa\'; |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baaa AS \'boo.baa\' USING JAR \'boo.jar\', FILE \'booo\', ARCHIVE \'baa\'; ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TABLE']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo.baa |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baa ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['LIKE', 'LIKE PARQUET']
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest tables for "CREATE TABLE boo LIKE |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo LIKE ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestTables: {},
|
|
|
- suggestDatabases: { appendDot: true },
|
|
|
- suggestKeywords: ['PARQUET']
|
|
|
+ suggestKeywords: ['USING']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest tables for "CREATE TABLE boo LIKE dbOne.|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo LIKE dbOne.',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestTables: { database: 'dbOne' }
|
|
|
+ suggestKeywords: ['ARCHIVE', 'FILE', 'JAR']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest hdfs for "CREATE TABLE boo LIKE PARQUET \'|"', function () {
|
|
|
+ xit('should suggest hdfs for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo LIKE PARQUET \'',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestHdfs: { path: ''}
|
|
|
+ suggestHdfs: { path: '' }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'boo\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo LOCATION \'',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'boo\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestHdfs: { path: ''}
|
|
|
+ suggestKeywords: ['ARCHIVE', 'FILE', 'JAR']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo LIKE PARQUET \'/blabla/\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY FUNCTION boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo LIKE PARQUET \'/blabla/\' ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY FUNCTION boo ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['COMMENT', 'CACHED IN'],
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'/baa\' |"', function () {
|
|
|
+ it('should not suggest keywords for "CREATE TEMPORARY FUNCTION boo AS \'boo.baa\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) LOCATION \'/baa\' ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY FUNCTION boo AS \'boo.baa\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TBLPROPERTIES', 'CACHED IN', 'AS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED |"', function () {
|
|
|
+ describe('Impala specific', function () {
|
|
|
+ it('should handle "CREATE FUNCTION foo.boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' SYMBOL=\'baaa\'; |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' SYMBOL=\'baaa\'; ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED BY (boo |"', function () {
|
|
|
+ it('should handle "CREATE AGGREGATE FUNCTION baa.boo(INT, DOUBLE) RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' ' +
|
|
|
+ 'MERGE_FN=\'cos\' PREPARE_FN=\'cos\' CLOSE_FN=\'cos\' SERIALIZE_FN=\'cos\' FINALIZE_FN=\'cos\'; |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED BY (boo ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'cos\' PREPARE_FN=\'cos\' CLOSE_FN=\'cos\' SERIALIZE_FN=\'cos\' FINALIZE_FN=\'cos\'; ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) WITH |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) WITH ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['SERDEPROPERTIES']
|
|
|
+ suggestKeywords: ['FUNCTION']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT |, boo INT) AS SELECT * FROM baa;"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT ',
|
|
|
- afterCursor: ', boo INT) AS SELECT * FROM baa;',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['COMMENT']
|
|
|
+ suggestKeywords: ['IF NOT EXISTS'],
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION IF |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION IF ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['NOT EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION IF NOT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED AS ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION IF NOT ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AVRO', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
|
|
|
+ suggestKeywords: ['EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo(|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo(',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
+ containsKeywords: ['INT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['FORMAT']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['DELIMITED']
|
|
|
+ suggestKeywords: ['RETURNS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['AS', 'FIELDS TERMINATED BY', 'LINES TERMINATED BY' ],
|
|
|
- doestNotContainKeywords: ['ROW FORMAT'],
|
|
|
+ containsKeywords: ['INT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['TERMINATED BY']
|
|
|
+ suggestKeywords: ['LOCATION']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
+ suggestKeywords: ['INIT_FN', 'UPDATE_FN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' |"', function () {
|
|
|
+ it('should suggest functions for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['AS', 'LINES TERMINATED BY' ],
|
|
|
- doestNotContainKeywords: ['FIELDS TERMINATED BY', 'ROW FORMAT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
+ suggestFunctions: {}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' LINES TERMINATED BY \'c\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' LINES TERMINATED BY \'c\' ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['AS' ],
|
|
|
- doestNotContainKeywords: ['FIELDS TERMINATED BY', 'LINES TERMINATED BY', 'ROW FORMAT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['UPDATE_FN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED |"', function () {
|
|
|
+ it('should suggest functions for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
+ suggestFunctions: {}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED BY \'z\' STORED AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED BY \'z\' STORED AS ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['PARQUET'],
|
|
|
- doesNotContainKeywords: ['ORC'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['MERGE_FN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CACHED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'tan\' ' +
|
|
|
+ 'PREPARE_FN=\'boo\' SERIALIZE_FN=\'baa\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CACHED ',
|
|
|
+ beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'tan\' PREPARE_FN=\'boo\' SERIALIZE_FN=\'baa\' ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['IN']
|
|
|
+ suggestKeywords: ['FINALIZE_FN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE ... TABLE ... PARTITIONED BY ... ROW FORMAT ... CACHED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName (id INT, col2 STRING COMMENT \'booo\', col3 BIGINT) ' +
|
|
|
- 'COMMENT \'Table comment...\' PARTITIONED BY (boo DOUBLE COMMENT \'booo boo\', baa INT) ' +
|
|
|
- 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
- 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
- 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
- 'CACHED ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['IN']
|
|
|
+ suggestKeywords: ['IF NOT EXISTS'],
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE ... TABLE ... LIKE PARQUET ... PARTITIONED BY ... ROW FORMAT ... CACHED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION IF |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE PARQUET \'/boo/baa\' ' +
|
|
|
- 'COMMENT \'Table comment...\' PARTITIONED BY (boo DOUBLE COMMENT \'booo boo\', baa INT) ' +
|
|
|
- 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
- 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
- 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
- 'CACHED ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION IF ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['IN']
|
|
|
+ suggestKeywords: ['NOT EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest tables for "CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION IF NOT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo',
|
|
|
+ beforeCursor: 'CREATE FUNCTION IF NOT ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['PARQUET'],
|
|
|
- suggestTables: {},
|
|
|
- suggestDatabases: {
|
|
|
- appendDot: true
|
|
|
- }
|
|
|
+ suggestKeywords: ['EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo.baa COMMENT \'Table comment...\' STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo.baa COMMENT \'Table comment...\' STORED ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
+ containsKeywords: ['INT'],
|
|
|
+ doesNotContainKeywords: ['ARRAY<>', '...'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE ... TABLE ... ROW FORMAT ... CACHED IN ... AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE dbOne.tableName ' +
|
|
|
- 'COMMENT \'Table comment...\' ' +
|
|
|
- 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
- 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
- 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
- 'CACHED IN \'boo\' AS ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['SELECT']
|
|
|
+ suggestKeywords: ['...']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should handle "create table four_k as select 4096 as x;|"', function () {
|
|
|
+ it('should not suggest keywords for "CREATE FUNCTION boo(INT |, BOOLEAN"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'create table four_k as select 4096 as x;',
|
|
|
- afterCursor: '',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT ',
|
|
|
+ afterCursor: ', BOOLEAN',
|
|
|
dialect: 'impala',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
- noErrors: true,
|
|
|
expectedResult: {
|
|
|
- lowerCase: true
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- describe('Hive specific', function () {
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN, |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN, ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['INT'],
|
|
|
+ doesNotContainKeywords: ['ARRAY<>', '...'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TABLE']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TEMPORARY |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN, STRING |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN, STRING ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['EXTERNAL TABLE', 'FUNCTION', 'TABLE']
|
|
|
+ suggestKeywords: ['...']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TEMPORARY EXTERNAL |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY EXTERNAL ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['TABLE']
|
|
|
+ suggestKeywords: ['RETURNS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest tables for "CREATE TEMPORARY TABLE foo.boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY TABLE foo.boo ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['INT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['LIKE']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest tables for "CREATE TABLE boo LIKE |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo LIKE dbOne.',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestTables: { database: 'dbOne' }
|
|
|
+ suggestKeywords: ['LOCATION']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int |"', function () {
|
|
|
+ it('should suggest hdfs for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE foo (id int ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['COMMENT']
|
|
|
+ suggestHdfs: { path: '' }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) ',
|
|
|
+ beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['COMMENT', 'CLUSTERED BY'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['SYMBOL']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) COMMENT \'boo\' |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) COMMENT \'boo\' ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['PARTITIONED BY', 'CLUSTERED BY'],
|
|
|
- doesNotContainKeywords: ['COMMENT'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
+ describe('CREATE INDEX', function () {
|
|
|
+ it('should handle "CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'COMPACT\' WITH DEFERRED REBUILD IDXPROPERTIES ("boo.baa"="ble", "blaa"=1) IN TABLE dbTwo.tblTwo ROW FORMAT DELIMITED STORED AS PARQUET LOCATION \'/baa/boo\' TBLPROPERTIES ("bla"=1) COMMENT \"booo\"; |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'COMPACT\' WITH DEFERRED REBUILD IDXPROPERTIES ' +
|
|
|
+ '("boo.baa"="ble", "blaa"=1) IN TABLE dbTwo.tblTwo ROW FORMAT DELIMITED STORED AS PARQUET LOCATION \'/baa/boo\' ' +
|
|
|
+ 'TBLPROPERTIES ("bla"=1) COMMENT \"booo\"; ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) PARTITIONED BY (boo INT) |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) PARTITIONED BY (boo INT) ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['CLUSTERED BY', 'SKEWED BY'],
|
|
|
- doesNotContainKeywords: ['COMMENT', 'PARTITIONED BY'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
+ it('should handle "CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'boo.baa.bitmap\'; |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'boo.baa.bitmap\'; ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 BUCKETS |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 BUCKETS ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['SKEWED BY'],
|
|
|
- doesNotContainKeywords: ['CLUSTERED BY', 'PARTITIONED BY'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['ON TABLE']
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'/baa\' |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) LOCATION \'/baa\' ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TBLPROPERTIES', 'AS']
|
|
|
- }
|
|
|
- });
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['TABLE']
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
- }
|
|
|
- });
|
|
|
+ it('should suggest tables for "CREATE INDEX bla ON TABLE |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestTables: {},
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SORTED BY', 'INTO']
|
|
|
- }
|
|
|
- });
|
|
|
+ it('should suggest columns for "CREATE INDEX bla ON TABLE foo.bar (|"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE foo.bar (',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestColumns: { database: 'foo', table: 'bar' }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest columns for "CREATE INDEX bla ON TABLE foo.bar (a, b, c, |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE foo.bar (a, b, c, ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestColumns: { database: 'foo', table: 'bar' }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['\'BITMAP\'', '\'COMPACT\'']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BIT|"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BIT',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['\'BITMAP\'', '\'COMPACT\'']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['WITH DEFERRED REBUILD', 'IDXPROPERTIES', 'IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['DEFERRED REBUILD']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['REBUILD']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED REBUILD |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED REBUILD ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IDXPROPERTIES', 'IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IDXPROPERTIES ("baa"="boo") |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IDXPROPERTIES ("baa"="boo") ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['TABLE']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest tables for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestTables: {},
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE boo |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE boo ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['FORMAT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['DELIMITED', 'SERDE']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['MAP KEYS TERMINATED BY', 'NULL DEFINED AS', 'LOCATION', 'TBLPROPERTIES', 'COMMENT'],
|
|
|
+ doesNotContainKeywords: ['AS'],
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED NULL |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED NULL ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['DEFINED AS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' STORED |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' STORED ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS', 'BY']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED AS |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED AS ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['ORC', 'PARQUET'],
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest hdfs for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'|"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestHdfs: { path: '' }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'/baa\' |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'/baa\' ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['TBLPROPERTIES', 'COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' TBLPROPERTIES ("baa"="boo") |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' TBLPROPERTIES ("baa"="boo") ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations: true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['COMMENT']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('CREATE ROLE', function () {
|
|
|
+ it('should handle "CREATE ROLE boo; |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE ROLE boo; ',
|
|
|
+ afterCursor: '',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('CREATE TABLE', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE ',
|
|
|
+ afterCursor: '',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IF NOT EXISTS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE TABLE IF |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE IF ',
|
|
|
+ afterCursor: '',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['NOT EXISTS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE TABLE IF NOT |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE IF NOT ',
|
|
|
+ afterCursor: '',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['EXISTS']
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should handle for "CREATE TABLE foo (id INT);|"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id INT);',
|
|
|
+ afterCursor: '',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id ',
|
|
|
+ afterCursor: '',
|
|
|
+ containsKeywords: ['BOOLEAN'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id INT, some FLOAT, bar |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id INT, some FLOAT, bar ',
|
|
|
+ afterCursor: '',
|
|
|
+ containsKeywords: ['BOOLEAN'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED |"', function () {
|
|
|
+ describe('Impala specific', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED ',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
+ suggestKeywords: ['TABLE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ASC', 'DESC']
|
|
|
+ suggestKeywords: ['LIKE', 'LIKE PARQUET']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b |, c)"', function () {
|
|
|
+ it('should suggest tables for "CREATE TABLE boo LIKE |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b ',
|
|
|
- afterCursor: ', c)',
|
|
|
- dialect: 'hive',
|
|
|
+ beforeCursor: 'CREATE TABLE boo LIKE ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ASC', 'DESC']
|
|
|
+ suggestTables: {},
|
|
|
+ suggestDatabases: { appendDot: true },
|
|
|
+ suggestKeywords: ['PARQUET']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b DESC, c) |"', function () {
|
|
|
+ it('should suggest tables for "CREATE TABLE boo LIKE dbOne.|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b DESC, c) ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo LIKE dbOne.',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['INTO']
|
|
|
+ suggestTables: { database: 'dbOne' }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) INTO 10 |"', function () {
|
|
|
+ it('should suggest hdfs for "CREATE TABLE boo LIKE PARQUET \'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo LIKE PARQUET \'',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['BUCKETS']
|
|
|
+ suggestHdfs: { path: ''}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b DESC, c) INTO 10 |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b DESC, c) INTO 10 ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo LOCATION \'',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['BUCKETS']
|
|
|
+ suggestHdfs: { path: ''}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo LIKE PARQUET \'/blabla/\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) SKEWED ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo LIKE PARQUET \'/blabla/\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['COMMENT', 'CACHED IN'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['BY']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED BY (a, b, c) |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'/baa\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) SKEWED BY (a, b, c) ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) LOCATION \'/baa\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ON']
|
|
|
+ suggestKeywords: ['TBLPROPERTIES', 'CACHED IN', 'AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED BY (a, b, c) ON ((1,2), (2,3)) |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) SKEWED BY (a, b, c) ON ((1,2), (2,3)) ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['STORED AS DIRECTORIES'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED BY (boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED BY (boo ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['INT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['AS', 'BY']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) WITH |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED AS ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) WITH ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AVRO', 'INPUTFORMAT', 'ORC', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
|
|
|
+ suggestKeywords: ['SERDEPROPERTIES']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT |, boo INT) AS SELECT * FROM baa;"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) PARTITIONED BY (boo INT, baa BIGINT ',
|
|
|
+ afterCursor: ', boo INT) AS SELECT * FROM baa;',
|
|
|
+ dialect: 'impala',
|
|
|
+ hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['FORMAT']
|
|
|
+ suggestKeywords: ['COMMENT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['DELIMITED', 'SERDE']
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['FIELDS TERMINATED BY', 'COLLECTION ITEMS TERMINATED BY', 'MAP KEYS TERMINATED BY', 'LINES TERMINATED BY', 'NULL DEFINED AS', 'STORED AS', 'LOCATION', 'TBLPROPERTIES', 'AS']
|
|
|
+ suggestKeywords: ['AVRO', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['KEYS TERMINATED BY']
|
|
|
+ suggestKeywords: ['FORMAT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' NULL DEFINED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' NULL DEFINED ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['DELIMITED']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['STORED AS'],
|
|
|
- doesNotContainKeywords: ['STORED BY'],
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['AS', 'FIELDS TERMINATED BY', 'LINES TERMINATED BY' ],
|
|
|
+ doestNotContainKeywords: ['ROW FORMAT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['TERMINATED BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED AS ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['ORC'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED BY \'handler\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED BY \'handler\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['WITH SERDEPROPERTIES'],
|
|
|
- doesNotContainKeywords: ['STORED BY'],
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['AS', 'LINES TERMINATED BY' ],
|
|
|
+ doestNotContainKeywords: ['FIELDS TERMINATED BY', 'ROW FORMAT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id int) STORED BY \'handler\' WITH |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' LINES TERMINATED BY \'c\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id int) STORED BY \'handler\' WITH ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' LINES TERMINATED BY \'c\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['AS' ],
|
|
|
+ doestNotContainKeywords: ['FIELDS TERMINATED BY', 'LINES TERMINATED BY', 'ROW FORMAT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SERDEPROPERTIES']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE ... TABLE ... PARTITIONED BY ... ROW FORMAT ... AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.foo (id INT COMMENT \'an int\', baa ARRAY<BIGINT>) COMMENT \'a table\' ' +
|
|
|
- 'PARTITIONED BY (boo DOUBLE, baa INT) ' +
|
|
|
- 'CLUSTERED BY (boo, baa) SORTED BY (boo ASC, baa) INTO 10 BUCKETS ' +
|
|
|
- 'SKEWED BY (a, b, c) ON ((\'val1\', \'val2\'), (1, 2, 3)) STORED AS DIRECTORIES ' +
|
|
|
- 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' ESCAPED BY \'o\' COLLECTION ITEMS TERMINATED BY \'d\' ' +
|
|
|
- 'MAP KEYS TERMINATED BY \'a\' LINES TERMINATED BY \'a\' NULL DEFINED AS \'o\' ' +
|
|
|
- 'STORED AS ORC LOCATION \'/asdf/boo/\' TBLPROPERTIES ("comment"="boo") AS ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['SELECT']
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE boo PARTITIONED BY ... STORED BY \'storage.handler\' WITH SERDEPROPERTIES ... AS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED BY \'z\' STORED AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo PARTITIONED BY (boo DOUBLE, baa INT) STORED BY \'storage.handler\' ' +
|
|
|
- 'WITH SERDEPROPERTIES (\'foo.bar\' = \'booo\', \'bar.foo\' = \'bla\') ' +
|
|
|
- 'LOCATION \'/asdf/boo/\' TBLPROPERTIES ("comment"="boo") AS ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED LINES TERMINATED BY \'z\' STORED AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SELECT']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest tables for "CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.boo LIKE | LOCATION \'/some/loc\';"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.boo LIKE ',
|
|
|
- afterCursor: ' LOCATION \'/some/loc\';',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['PARQUET'],
|
|
|
+ doesNotContainKeywords: ['ORC'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestTables: {},
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CACHED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CACHED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo(id |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE ... TABLE ... PARTITIONED BY ... ROW FORMAT ... CACHED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo(id ',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName (id INT, col2 STRING COMMENT \'booo\', col3 BIGINT) ' +
|
|
|
+ 'COMMENT \'Table comment...\' PARTITIONED BY (boo DOUBLE COMMENT \'booo boo\', baa INT) ' +
|
|
|
+ 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
+ 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
+ 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
+ 'CACHED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<INT>, boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE ... TABLE ... LIKE PARQUET ... PARTITIONED BY ... ROW FORMAT ... CACHED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla ARRAY<INT>, boo ',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE PARQUET \'/boo/baa\' ' +
|
|
|
+ 'COMMENT \'Table comment...\' PARTITIONED BY (boo DOUBLE COMMENT \'booo boo\', baa INT) ' +
|
|
|
+ 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
+ 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
+ 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
+ 'CACHED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['IN']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<|"', function () {
|
|
|
+ it('should suggest tables for "CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla ARRAY<',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['PARQUET'],
|
|
|
+ suggestTables: {},
|
|
|
+ suggestDatabases: {
|
|
|
+ appendDot: true
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla MAP<|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo.baa COMMENT \'Table comment...\' STORED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla MAP<',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE IF NOT EXISTS dbOne.tableName LIKE boo.baa COMMENT \'Table comment...\' STORED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
- doesNotContainKeywords: ['MAP<>'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla MAP<STRING, STRING>, boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE ... TABLE ... ROW FORMAT ... CACHED IN ... AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla MAP<STRING, STRING>, boo ',
|
|
|
+ beforeCursor: 'CREATE TABLE dbOne.tableName ' +
|
|
|
+ 'COMMENT \'Table comment...\' ' +
|
|
|
+ 'WITH SERDEPROPERTIES ( \'key\' = \'value\', \'key2\' = \'value 2\' ) ' +
|
|
|
+ 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'a\' ESCAPED BY \'c\' LINES TERMINATED BY \'q\' STORED AS PARQUET ' +
|
|
|
+ 'LOCATION \'/baa/baa\' TBLPROPERTIES (\'key\' = \'value\', \'key2\' = \'value 2\') ' +
|
|
|
+ 'CACHED IN \'boo\' AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
+ dialect: 'impala',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should not suggest keywords for "CREATE TABLE boo (baa STRUCT<foo:INT, |"', function () {
|
|
|
+ it('should handle "create table four_k as select 4096 as x;|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE boo (baa STRUCT<foo:INT, ',
|
|
|
+ beforeCursor: 'create table four_k as select 4096 as x;',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ dialect: 'impala',
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
+ noErrors: true,
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: true
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id INT, bla MAP<|, boo BIGINT, bla INT"', function () {
|
|
|
+ describe('Hive specific', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id INT, bla MAP<',
|
|
|
- afterCursor: ', boo BIGINT, bla INT)',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
- doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['TABLE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id INT, bla MAP<|>, boo BIGINT, bla INT"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id INT, bla MAP<',
|
|
|
- afterCursor: '>, boo BIGINT, bla INT)',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
- doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['EXTERNAL TABLE', 'FUNCTION', 'MACRO', 'TABLE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla STRUCT<foo:|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY EXTERNAL |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla STRUCT<foo:',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY EXTERNAL ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['TABLE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla MAP<BIGINT, STRUCT<foo:ARRAY<|, bla DOUBLE"', function () {
|
|
|
+ it('should suggest tables for "CREATE TEMPORARY TABLE foo.boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla MAP<BIGINT, STRUCT<foo:ARRAY<',
|
|
|
- afterCursor: ', bla DOUBLE',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY TABLE foo.boo ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['LIKE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla MAP<BIGINT, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE |, bla:DOUBLE>"', function () {
|
|
|
+ it('should suggest tables for "CREATE TABLE boo LIKE |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla MAP<BIGINT, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE ',
|
|
|
- afterCursor: ', bla:DOUBLE>',
|
|
|
+ beforeCursor: 'CREATE TABLE boo LIKE dbOne.',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['COMMENT']
|
|
|
+ suggestTables: { database: 'dbOne' }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla MAP<|, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE, doo:VARCHAR, bla:DOUBLE>"', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla MAP<',
|
|
|
- afterCursor: ', STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE, doo:VARCHAR, bla:DOUBLE>',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE foo (id int ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
- doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['COMMENT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id INT, ba STRUCT<boo:INT COMMENT \'Some Comment\', bla:BIGINT>, bla MAP<INT,|>, boo BIGINT, bla INT"', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id INT, ba STRUCT<boo:INT COMMENT \'Some Comment\', bla:BIGINT>, bla MAP<INT,',
|
|
|
- afterCursor: '>, boo BIGINT, bla INT)',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ containsKeywords: ['COMMENT', 'CLUSTERED BY'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (id UNIONTYPE<INT, BIGINT, |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) COMMENT \'boo\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (id UNIONTYPE<INT, BIGINT, ',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) COMMENT \'boo\' ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ containsKeywords: ['PARTITIONED BY', 'CLUSTERED BY'],
|
|
|
+ doesNotContainKeywords: ['COMMENT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TEMPORARY EXTERNAL TABLE foo (id UNIONTYPE<,,,STRUCT<boo:|>,BIGINT"', function () {
|
|
|
+ it('should suggest keywords for "CREATE EXTERNAL TABLE foo (id int) PARTITIONED BY (boo INT) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE foo (id UNIONTYPE<,,,STRUCT<boo:',
|
|
|
- afterCursor: '>,BIGINT',
|
|
|
+ beforeCursor: 'CREATE EXTERNAL TABLE foo (id int) PARTITIONED BY (boo INT) ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ containsKeywords: ['CLUSTERED BY', 'SKEWED BY'],
|
|
|
+ doesNotContainKeywords: ['COMMENT', 'PARTITIONED BY'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<MAP<|>>"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 BUCKETS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TABLE foo (bla ARRAY<MAP<',
|
|
|
- afterCursor: '>>',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 BUCKETS ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['BIGINT'],
|
|
|
- doesNotContainKeywords: ['MAP<>'],
|
|
|
+ containsKeywords: ['SKEWED BY'],
|
|
|
+ doesNotContainKeywords: ['CLUSTERED BY', 'PARTITIONED BY'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('CREATE VIEW', function () {
|
|
|
- it('should handle "CREATE VIEW foo AS SELECT a, | FROM tableOne"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW foo AS SELECT a, ',
|
|
|
- afterCursor: ' FROM tableOne',
|
|
|
- hasLocations:true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestAggregateFunctions: true,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
- suggestFunctions: {},
|
|
|
- suggestColumns: { table: 'tableOne' },
|
|
|
- suggestKeywords: ['*']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['IF NOT EXISTS'],
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW | boo AS select * from baa;"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW ',
|
|
|
- afterCursor: ' boo AS SELECT * FROM baa;',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['IF NOT EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW IF |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['NOT EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW IF NOT |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF NOT ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['EXISTS']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW boo AS |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW boo AS ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SELECT']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo AS |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF NOT EXISTS boo AS ',
|
|
|
- afterCursor: '',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SELECT']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('Hive specific', function () {
|
|
|
- it('should suggest columns for "CREATE VIEW IF NOT EXISTS db.foo (baa COMMENT \'foo bar\', ble) COMMENT \'baa\' TBLPROPERTIES ("boo.baa"="buu") AS SELECT a, | FROM tableOne"', function () {
|
|
|
+
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) LOCATION \'/baa\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF NOT EXISTS db.foo (baa COMMENT \'foo bar\', ble) COMMENT \'baa\' TBLPROPERTIES ("boo.baa"="buu") AS SELECT a, ',
|
|
|
- afterCursor: ' FROM tableOne',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) LOCATION \'/baa\' ',
|
|
|
+ afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations:true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestAggregateFunctions: true,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
- suggestFunctions: {},
|
|
|
- suggestColumns: { table: 'tableOne' },
|
|
|
- suggestKeywords: ['*']
|
|
|
+ suggestKeywords: ['TBLPROPERTIES', 'AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should handle "CREATE VIEW v1 AS WITH q1 AS ( SELECT key FROM src WHERE key = \'5\') SELECT * FROM q1;|', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW v1 AS WITH q1 AS ( SELECT key FROM src WHERE key = \'5\') SELECT * FROM q1;',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations:true,
|
|
|
- containsKeywords: ['SELECT', 'WITH'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['COMMENT', 'TBLPROPERTIES', 'AS']
|
|
|
+ suggestKeywords: ['SORTED BY', 'INTO']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- describe('Impala specific', function () {
|
|
|
- it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('CREATE ROLE', function () {
|
|
|
- it('should handle "CREATE ROLE boo; |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE ROLE boo; ',
|
|
|
- afterCursor: '',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
- });
|
|
|
|
|
|
- describe('CREATE FUNCTION', function () {
|
|
|
- describe('Hive specific', function () {
|
|
|
- it('should handle "CREATE TEMPORARY FUNCTION baaa AS \'boo.baa\'; |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY FUNCTION baaa AS \'boo.baa\'; ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['ASC', 'DESC']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should handle "CREATE FUNCTION boo.baaa AS \'boo.baa\' USING JAR \'boo.jar\', FILE \'booo\', ARCHIVE \'baa\'; |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b |, c)"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baaa AS \'boo.baa\' USING JAR \'boo.jar\', FILE \'booo\', ARCHIVE \'baa\'; ',
|
|
|
- afterCursor: '',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b ',
|
|
|
+ afterCursor: ', c)',
|
|
|
dialect: 'hive',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['ASC', 'DESC']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo.baa |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b DESC, c) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baa ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b DESC, c) ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['INTO']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) INTO 10 |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) INTO 10 ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['USING']
|
|
|
+ suggestKeywords: ['BUCKETS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) CLUSTERED (a, b, c) SORTED BY (a ASC, b DESC, c) INTO 10 |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) CLUSTERED BY (a, b, c) SORTED BY (a ASC, b DESC, c) INTO 10 ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ARCHIVE', 'FILE', 'JAR']
|
|
|
+ suggestKeywords: ['BUCKETS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- xit('should suggest hdfs for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) SKEWED ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestHdfs: { path: '' }
|
|
|
+ suggestKeywords: ['BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'boo\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED BY (a, b, c) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo.baa AS \'baa.boo\' USING FILE \'boo\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) SKEWED BY (a, b, c) ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ARCHIVE', 'FILE', 'JAR']
|
|
|
+ suggestKeywords: ['ON']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE TEMPORARY FUNCTION boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) SKEWED BY (a, b, c) ON ((1,2), (2,3)) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY FUNCTION boo ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) SKEWED BY (a, b, c) ON ((1,2), (2,3)) ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
+ containsKeywords: ['STORED AS DIRECTORIES'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should not suggest keywords for "CREATE TEMPORARY FUNCTION boo AS \'boo.baa\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE TEMPORARY FUNCTION boo AS \'boo.baa\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS', 'BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- describe('Impala specific', function () {
|
|
|
- it('should handle "CREATE FUNCTION foo.boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' SYMBOL=\'baaa\'; |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' SYMBOL=\'baaa\'; ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AVRO', 'INPUTFORMAT', 'ORC', 'PARQUET', 'RCFILE', 'SEQUENCEFILE', 'TEXTFILE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should handle "CREATE AGGREGATE FUNCTION baa.boo(INT, DOUBLE) RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' ' +
|
|
|
- 'MERGE_FN=\'cos\' PREPARE_FN=\'cos\' CLOSE_FN=\'cos\' SERIALIZE_FN=\'cos\' FINALIZE_FN=\'cos\'; |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'cos\' PREPARE_FN=\'cos\' CLOSE_FN=\'cos\' SERIALIZE_FN=\'cos\' FINALIZE_FN=\'cos\'; ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['FORMAT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['FUNCTION']
|
|
|
+ suggestKeywords: ['DELIMITED', 'SERDE']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['IF NOT EXISTS'],
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
+ suggestKeywords: ['FIELDS TERMINATED BY', 'COLLECTION ITEMS TERMINATED BY', 'MAP KEYS TERMINATED BY', 'LINES TERMINATED BY', 'NULL DEFINED AS', 'STORED AS', 'LOCATION', 'TBLPROPERTIES', 'AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION IF |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION IF ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['NOT EXISTS']
|
|
|
+ suggestKeywords: ['KEYS TERMINATED BY']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION IF NOT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' NULL DEFINED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION IF NOT ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' NULL DEFINED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['EXISTS']
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo(|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo(',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['STORED AS'],
|
|
|
+ doesNotContainKeywords: ['STORED BY'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['RETURNS']
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) ROW FORMAT DELIMITED MAP KEYS TERMINATED BY \'a\' STORED AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['ORC'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED BY \'handler\' |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED BY \'handler\' ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['WITH SERDEPROPERTIES'],
|
|
|
+ doesNotContainKeywords: ['STORED BY'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['LOCATION']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id int) STORED BY \'handler\' WITH |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id int) STORED BY \'handler\' WITH ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['INIT_FN', 'UPDATE_FN']
|
|
|
+ suggestKeywords: ['SERDEPROPERTIES']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest functions for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE ... TABLE ... PARTITIONED BY ... ROW FORMAT ... AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.foo (id INT COMMENT \'an int\', baa ARRAY<BIGINT>) COMMENT \'a table\' ' +
|
|
|
+ 'PARTITIONED BY (boo DOUBLE, baa INT) ' +
|
|
|
+ 'CLUSTERED BY (boo, baa) SORTED BY (boo ASC, baa) INTO 10 BUCKETS ' +
|
|
|
+ 'SKEWED BY (a, b, c) ON ((\'val1\', \'val2\'), (1, 2, 3)) STORED AS DIRECTORIES ' +
|
|
|
+ 'ROW FORMAT DELIMITED FIELDS TERMINATED BY \'b\' ESCAPED BY \'o\' COLLECTION ITEMS TERMINATED BY \'d\' ' +
|
|
|
+ 'MAP KEYS TERMINATED BY \'a\' LINES TERMINATED BY \'a\' NULL DEFINED AS \'o\' ' +
|
|
|
+ 'STORED AS ORC LOCATION \'/asdf/boo/\' TBLPROPERTIES ("comment"="boo") AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
- suggestAggregateFunctions: true,
|
|
|
- suggestFunctions: {}
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE boo PARTITIONED BY ... STORED BY \'storage.handler\' WITH SERDEPROPERTIES ... AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo PARTITIONED BY (boo DOUBLE, baa INT) STORED BY \'storage.handler\' ' +
|
|
|
+ 'WITH SERDEPROPERTIES (\'foo.bar\' = \'booo\', \'bar.foo\' = \'bla\') ' +
|
|
|
+ 'LOCATION \'/asdf/boo/\' TBLPROPERTIES ("comment"="boo") AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['UPDATE_FN']
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest functions for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'|"', function () {
|
|
|
+ it('should suggest tables for "CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.boo LIKE | LOCATION \'/some/loc\';"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE IF NOT EXISTS db.boo LIKE ',
|
|
|
+ afterCursor: ' LOCATION \'/some/loc\';',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
- suggestAggregateFunctions: true,
|
|
|
- suggestFunctions: {}
|
|
|
+ suggestTables: {},
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['MERGE_FN']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'tan\' ' +
|
|
|
- 'PREPARE_FN=\'boo\' SERIALIZE_FN=\'baa\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo(id |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE AGGREGATE FUNCTION boo() RETURNS INT LOCATION \'/boo\' INIT_FN=\'cos\' UPDATE_FN=\'sin\' MERGE_FN=\'tan\' PREPARE_FN=\'boo\' SERIALIZE_FN=\'baa\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo(id ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['FINALIZE_FN']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<INT>, boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla ARRAY<INT>, boo ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['IF NOT EXISTS'],
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION IF |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION IF ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla ARRAY<',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['NOT EXISTS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION IF NOT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla MAP<|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION IF NOT ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla MAP<',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
+ doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['EXISTS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla MAP<STRING, STRING>, boo |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla MAP<STRING, STRING>, boo ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
- doesNotContainKeywords: ['ARRAY<>', '...'],
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN |"', function () {
|
|
|
+ it('should not suggest keywords for "CREATE TABLE boo (baa STRUCT<foo:INT, |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN ',
|
|
|
+ beforeCursor: 'CREATE TABLE boo (baa STRUCT<foo:INT, ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['...']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should not suggest keywords for "CREATE FUNCTION boo(INT |, BOOLEAN"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id INT, bla MAP<|, boo BIGINT, bla INT"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT ',
|
|
|
- afterCursor: ', BOOLEAN',
|
|
|
- dialect: 'impala',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id INT, bla MAP<',
|
|
|
+ afterCursor: ', boo BIGINT, bla INT)',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
+ doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN, |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id INT, bla MAP<|>, boo BIGINT, bla INT"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN, ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
- doesNotContainKeywords: ['ARRAY<>', '...'],
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id INT, bla MAP<',
|
|
|
+ afterCursor: '>, boo BIGINT, bla INT)',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
+ doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN, STRING |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla STRUCT<foo:|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN, STRING ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla STRUCT<foo:',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['...']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla MAP<BIGINT, STRUCT<foo:ARRAY<|, bla DOUBLE"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla MAP<BIGINT, STRUCT<foo:ARRAY<',
|
|
|
+ afterCursor: ', bla DOUBLE',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['RETURNS']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla MAP<BIGINT, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE |, bla:DOUBLE>"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
- containsKeywords: ['INT'],
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla MAP<BIGINT, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE ',
|
|
|
+ afterCursor: ', bla:DOUBLE>',
|
|
|
+ dialect: 'hive',
|
|
|
expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['COMMENT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla MAP<|, STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE, doo:VARCHAR, bla:DOUBLE>"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla MAP<',
|
|
|
+ afterCursor: ', STRUCT<boo: INT, foo:STRUCT<blo:DOUBLE, doo:VARCHAR, bla:DOUBLE>',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
+ doesNotContainKeywords: ['MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['LOCATION']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest hdfs for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'|"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id INT, ba STRUCT<boo:INT COMMENT \'Some Comment\', bla:BIGINT>, bla MAP<INT,|>, boo BIGINT, bla INT"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id INT, ba STRUCT<boo:INT COMMENT \'Some Comment\', bla:BIGINT>, bla MAP<INT,',
|
|
|
+ afterCursor: '>, boo BIGINT, bla INT)',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestHdfs: { path: '' }
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (id UNIONTYPE<INT, BIGINT, |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE FUNCTION boo(INT, BOOLEAN) RETURNS INT LOCATION \'/boo\' ',
|
|
|
+ beforeCursor: 'CREATE TABLE foo (id UNIONTYPE<INT, BIGINT, ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'impala',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['SYMBOL']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- describe('CREATE INDEX', function () {
|
|
|
- it('should handle "CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'COMPACT\' WITH DEFERRED REBUILD IDXPROPERTIES ("boo.baa"="ble", "blaa"=1) IN TABLE dbTwo.tblTwo ROW FORMAT DELIMITED STORED AS PARQUET LOCATION \'/baa/boo\' TBLPROPERTIES ("bla"=1) COMMENT \"booo\"; |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'COMPACT\' WITH DEFERRED REBUILD IDXPROPERTIES ' +
|
|
|
- '("boo.baa"="ble", "blaa"=1) IN TABLE dbTwo.tblTwo ROW FORMAT DELIMITED STORED AS PARQUET LOCATION \'/baa/boo\' ' +
|
|
|
- 'TBLPROPERTIES ("bla"=1) COMMENT \"booo\"; ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should handle "CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'boo.baa.bitmap\'; |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE db.tbl (a, b, c) AS \'boo.baa.bitmap\'; ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- containsKeywords: ['SELECT'],
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE INDEX bla |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['ON TABLE']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TABLE']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest tables for "CREATE INDEX bla ON TABLE |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestTables: {},
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest columns for "CREATE INDEX bla ON TABLE foo.bar (|"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE foo.bar (',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestColumns: { database: 'foo', table: 'bar' }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest columns for "CREATE INDEX bla ON TABLE foo.bar (a, b, c, |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE foo.bar (a, b, c, ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestColumns: { database: 'foo', table: 'bar' }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
- }
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY EXTERNAL TABLE foo (id UNIONTYPE<,,,STRUCT<boo:|>,BIGINT"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TEMPORARY EXTERNAL TABLE foo (id UNIONTYPE<,,,STRUCT<boo:',
|
|
|
+ afterCursor: '>,BIGINT',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT', 'MAP<>'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['\'BITMAP\'', '\'COMPACT\'']
|
|
|
- }
|
|
|
+ it('should suggest keywords for "CREATE TABLE foo (bla ARRAY<MAP<|>>"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE TABLE foo (bla ARRAY<MAP<',
|
|
|
+ afterCursor: '>>',
|
|
|
+ dialect: 'hive',
|
|
|
+ containsKeywords: ['BIGINT'],
|
|
|
+ doesNotContainKeywords: ['MAP<>'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BIT|"', function () {
|
|
|
+ describe('CREATE TEMPORARY MACRO', function () {
|
|
|
+ it('should suggest handle "CREATE TEMPORARY MACRO boo(x INT, y INT) x + cos(y);|"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BIT',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY MACRO boo(x INT, y INT) x + cos(y);',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
+ noErrors: true,
|
|
|
hasLocations: true,
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['\'BITMAP\'', '\'COMPACT\'']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ',
|
|
|
+ beforeCursor: 'CREATE ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
+ containsKeywords: ['TEMPORARY MACRO'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['WITH DEFERRED REBUILD', 'IDXPROPERTIES', 'IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
+ containsKeywords: ['MACRO'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['DEFERRED REBUILD']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY MACRO boo(x |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY MACRO boo(x ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
+ containsKeywords: ['INT', 'STRING'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['REBUILD']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED REBUILD |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE TEMPORARY MACRO boo(x INT, y |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' WITH DEFERRED REBUILD ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY MACRO boo(x INT, y ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
+ containsKeywords: ['INT', 'STRING'],
|
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['IDXPROPERTIES', 'IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ lowerCase: false
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IDXPROPERTIES ("baa"="boo") |"', function () {
|
|
|
+ it('should suggest functions for "CREATE TEMPORARY MACRO boo(x INT, y STRING) |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IDXPROPERTIES ("baa"="boo") ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY MACRO boo(x INT, y STRING) ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['IN TABLE', 'ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ suggestFunctions: {}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN |"', function () {
|
|
|
+ it('should suggest functions for "CREATE TEMPORARY MACRO boo(x INT, y STRING) cos(x) + y - |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN ',
|
|
|
+ beforeCursor: 'CREATE TEMPORARY MACRO boo(x INT, y STRING) cos(x) + y - ',
|
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
|
hasLocations: true,
|
|
|
+ containsKeywords: ['CASE'],
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['TABLE']
|
|
|
+ suggestFunctions: { types: ['NUMBER'] }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
+ });
|
|
|
|
|
|
- it('should suggest tables for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE |"', function () {
|
|
|
+ describe('CREATE VIEW', function () {
|
|
|
+ it('should handle "CREATE VIEW foo AS SELECT a, | FROM tableOne"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
+ beforeCursor: 'CREATE VIEW foo AS SELECT a, ',
|
|
|
+ afterCursor: ' FROM tableOne',
|
|
|
+ hasLocations:true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestTables: {},
|
|
|
- suggestDatabases: { appendDot: true }
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
+ suggestFunctions: {},
|
|
|
+ suggestColumns: { table: 'tableOne' },
|
|
|
+ suggestKeywords: ['*']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE boo |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' IN TABLE boo ',
|
|
|
+ beforeCursor: 'CREATE VIEW ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ROW FORMAT', 'STORED AS', 'STORED BY', 'LOCATION', 'TBLPROPERTIES', 'COMMENT']
|
|
|
+ suggestKeywords: ['IF NOT EXISTS'],
|
|
|
+ suggestDatabases: { appendDot: true }
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW | boo AS select * from baa;"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
+ beforeCursor: 'CREATE VIEW ',
|
|
|
+ afterCursor: ' boo AS SELECT * FROM baa;',
|
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['FORMAT']
|
|
|
+ suggestKeywords: ['IF NOT EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW IF |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT ',
|
|
|
+ beforeCursor: 'CREATE VIEW IF ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['DELIMITED', 'SERDE']
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['MAP KEYS TERMINATED BY', 'NULL DEFINED AS', 'LOCATION', 'TBLPROPERTIES', 'COMMENT'],
|
|
|
- doesNotContainKeywords: ['AS'],
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
+ suggestKeywords: ['NOT EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED NULL |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW IF NOT |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'BITMAP\' ROW FORMAT DELIMITED NULL ',
|
|
|
+ beforeCursor: 'CREATE VIEW IF NOT ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['DEFINED AS']
|
|
|
+ suggestKeywords: ['EXISTS']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW boo AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED ',
|
|
|
+ beforeCursor: 'CREATE VIEW boo AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS']
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' STORED |"', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo AS |"', function () {
|
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' STORED ',
|
|
|
+ beforeCursor: 'CREATE VIEW IF NOT EXISTS boo AS ',
|
|
|
afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['AS', 'BY']
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED AS |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' ROW FORMAT DELIMITED STORED AS ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- containsKeywords: ['ORC', 'PARQUET'],
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false
|
|
|
- }
|
|
|
+ describe('Hive specific', function () {
|
|
|
+ it('should suggest columns for "CREATE VIEW IF NOT EXISTS db.foo (baa COMMENT \'foo bar\', ble) COMMENT \'baa\' TBLPROPERTIES ("boo.baa"="buu") AS SELECT a, | FROM tableOne"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE VIEW IF NOT EXISTS db.foo (baa COMMENT \'foo bar\', ble) COMMENT \'baa\' TBLPROPERTIES ("boo.baa"="buu") AS SELECT a, ',
|
|
|
+ afterCursor: ' FROM tableOne',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations:true,
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
+ suggestFunctions: {},
|
|
|
+ suggestColumns: { table: 'tableOne' },
|
|
|
+ suggestKeywords: ['*']
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- it('should suggest hdfs for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'|"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestHdfs: { path: '' }
|
|
|
- }
|
|
|
+ it('should handle "CREATE VIEW v1 AS WITH q1 AS ( SELECT key FROM src WHERE key = \'5\') SELECT * FROM q1;|', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE VIEW v1 AS WITH q1 AS ( SELECT key FROM src WHERE key = \'5\') SELECT * FROM q1;',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ hasLocations:true,
|
|
|
+ containsKeywords: ['SELECT', 'WITH'],
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'/baa\' |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' LOCATION \'/baa\' ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['TBLPROPERTIES', 'COMMENT']
|
|
|
- }
|
|
|
+ it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'hive',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['COMMENT', 'TBLPROPERTIES', 'AS']
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- it('should suggest keywords for "CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' TBLPROPERTIES ("baa"="boo") |"', function () {
|
|
|
- assertAutoComplete({
|
|
|
- beforeCursor: 'CREATE INDEX bla ON TABLE boo (a, b, c) AS \'COMPACT\' TBLPROPERTIES ("baa"="boo") ',
|
|
|
- afterCursor: '',
|
|
|
- dialect: 'hive',
|
|
|
- hasLocations: true,
|
|
|
- expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
- suggestKeywords: ['COMMENT']
|
|
|
- }
|
|
|
+ describe('Impala specific', function () {
|
|
|
+ it('should suggest keywords for "CREATE VIEW IF NOT EXISTS boo |"', function () {
|
|
|
+ assertAutoComplete({
|
|
|
+ beforeCursor: 'CREATE VIEW IF NOT EXISTS boo ',
|
|
|
+ afterCursor: '',
|
|
|
+ dialect: 'impala',
|
|
|
+ expectedResult: {
|
|
|
+ lowerCase: false,
|
|
|
+ suggestKeywords: ['AS']
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
});
|
|
|
+
|
|
|
});
|
|
|
});
|