|
@@ -102,7 +102,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['WHERE', 'GROUP BY', 'ORDER BY', 'LIMIT', 'FULL JOIN', 'FULL OUTER JOIN', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
|
|
|
|
+ suggestKeywords: ['WHERE', 'GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'UNION', 'FULL JOIN', 'FULL OUTER JOIN', 'INNER JOIN', 'JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -2551,7 +2551,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['WHERE', 'GROUP BY', 'WINDOW', 'ORDER BY', 'LIMIT', 'CROSS JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
|
|
|
|
+ suggestKeywords: ['WHERE', 'GROUP BY', 'HAVING', 'WINDOW', 'ORDER BY', 'CLUSTER BY', 'DISTRIBUTE BY', 'SORT BY', 'LIMIT', 'UNION', 'CROSS JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -2564,7 +2564,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['WHERE', 'GROUP BY', 'WINDOW', 'ORDER BY', 'LIMIT', 'CROSS JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
|
|
|
|
+ suggestKeywords: ['WHERE', 'GROUP BY', 'HAVING', 'WINDOW', 'ORDER BY', 'CLUSTER BY', 'DISTRIBUTE BY', 'SORT BY', 'LIMIT', 'UNION', 'CROSS JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -2601,9 +2601,9 @@ define([
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
dialect: 'hive',
|
|
dialect: 'hive',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ containsKeywords: ['WHERE', 'HAVING'],
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['WHERE', 'GROUP BY', 'WINDOW', 'ORDER BY', 'LIMIT', 'CROSS JOIN', 'FULL JOIN', 'FULL OUTER JOIN', 'JOIN', 'LATERAL VIEW', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN']
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -3134,7 +3134,7 @@ define([
|
|
|
dialect: 'impala',
|
|
dialect: 'impala',
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['WHERE', 'GROUP BY', 'ORDER BY', 'LIMIT', 'FULL JOIN', 'FULL OUTER JOIN', 'INNER JOIN', 'JOIN', 'LEFT ANTI JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT ANTI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN'],
|
|
|
|
|
|
|
+ suggestKeywords: ['WHERE', 'GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'OFFSET', 'UNION', 'FULL JOIN', 'FULL OUTER JOIN', 'INNER JOIN', 'JOIN', 'LEFT ANTI JOIN', 'LEFT JOIN', 'LEFT OUTER JOIN', 'LEFT SEMI JOIN', 'RIGHT ANTI JOIN', 'RIGHT JOIN', 'RIGHT OUTER JOIN', 'RIGHT SEMI JOIN'],
|
|
|
locations: [
|
|
locations: [
|
|
|
{type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25}, table: 'testTableA'},
|
|
{type: 'table', location: { first_line: 1, last_line: 1, first_column: 15, last_column: 25}, table: 'testTableA'},
|
|
|
{type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 41}, table: 'testTableB'}
|
|
{type: 'table', location: { first_line: 1, last_line: 1, first_column: 31, last_column: 41}, table: 'testTableB'}
|
|
@@ -4238,7 +4238,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['GROUP BY', 'ORDER BY', 'LIMIT', '<', '<=', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
|
|
|
|
+ suggestKeywords: ['GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'UNION', '<', '<=', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -4251,7 +4251,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['GROUP BY', 'ORDER BY', 'LIMIT', '<', '<=', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
|
|
|
|
+ suggestKeywords: ['GROUP BY', 'HAVING', 'ORDER BY', 'LIMIT', 'UNION', '<', '<=', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -4451,7 +4451,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['GROUP BY', 'WINDOW', 'ORDER BY', 'LIMIT', '<', '<=', '<=>', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
|
|
|
|
+ suggestKeywords: ['GROUP BY', 'HAVING', 'WINDOW', 'ORDER BY', 'CLUSTER BY', 'DISTRIBUTE BY', 'SORT BY', 'LIMIT', 'UNION', '<', '<=', '<=>', '<>', '=', '>', '>=', 'AND', 'BETWEEN', 'IN', 'IS NOT NULL', 'IS NULL', 'NOT BETWEEN', 'NOT IN', 'OR']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -4666,80 +4666,259 @@ define([
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- describe('ORDER BY Clause', function () {
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM testTable ORDER |"', function () {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM testTable ORDER ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['BY']
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ it('should suggest columns for "SELECT t1.testTableColumn1, t2.testTableColumn3 FROM testTable1 t1 JOIN testTable2 t2 ON t1.|"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT t1.testTableColumn1, t2.testTableColumn3 FROM testTable1 t1 JOIN testTable2 t2 ON t1.',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestColumns: { table: 'testTable1' }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM testTable ORDER BY |"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM testTable ORDER BY ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
|
|
- suggestColumns: { table: 'testTable' }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ it('should suggest columns for "SELECT b.| FROM dbOne.foo f JOIN dbOne.bar b"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT b.',
|
|
|
|
|
+ afterCursor: ' FROM dbOne.foo f JOIN dbOne.bar b',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ dialect: 'impala',
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'bar', database: 'dbOne' }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY |"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
|
|
- suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ it('should suggest columns for "SELECT t1.testTableColumn1, t2.testTableColumn3 FROM database_two.testTable1 t1 JOIN testTable2 t2 ON t1.|"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT t1.testTableColumn1, t2.testTableColumn3 FROM database_two.testTable1 t1 JOIN testTable2 t2 ON t1.',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestColumns: { table: 'testTable1', database: 'database_two' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT testTable.| FROM testTable"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT testTable.',
|
|
|
|
|
+ afterCursor: ' FROM testTable',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns "SELECT tt.| FROM testTable tt"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT tt.',
|
|
|
|
|
+ afterCursor: ' FROM testTable tt',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT tt.| FROM database_two.testTable tt"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT tt.',
|
|
|
|
|
+ afterCursor: ' FROM database_two.testTable tt',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'testTable', database: 'database_two' }
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
|
|
+ it('should suggest columns for "SELECT tta.| FROM testTableA tta, testTableB ttb"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT tta.',
|
|
|
|
|
+ afterCursor: ' FROM testTableA tta, testTableB ttb',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'testTableA' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT ttb.',
|
|
|
|
|
+ afterCursor: ' FROM testTableA tta, testTableB ttb',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['*'],
|
|
|
|
|
+ suggestColumns: { table: 'testTableB' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ describe('ORDER BY Clause', function () {
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM testTable ORDER |"', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTable ORDER ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['BY']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM testTable ORDER BY |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTable ORDER BY ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['ASC', 'DESC', 'LIMIT', 'UNION']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY foo, |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo, ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY foo ASC, |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ASC, ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['ASC', 'DESC', 'LIMIT', 'UNION']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |, bla"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
+ afterCursor: ', bla',
|
|
|
|
|
+ containsKeywords: ['ASC', 'DESC'],
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo LIMIT 10 |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo LIMIT 10 ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['UNION']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ describe('Impala specific', function () {
|
|
|
it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo |"', function() {
|
|
it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ',
|
|
beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
- dialect: 'generic',
|
|
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ASC', 'DESC', 'LIMIT']
|
|
|
|
|
|
|
+ suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT', 'OFFSET', 'UNION']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY foo, |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY 1 |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo, ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY 1 ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
|
|
- suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
|
|
+ suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT', 'OFFSET', 'UNION']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM database_two.testTable ORDER BY foo ASC, |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo NULLS |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ASC, ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo NULLS ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestAnalyticFunctions: true,
|
|
|
|
|
- suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
|
|
+ suggestKeywords: ['FIRST', 'LAST']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -4748,282 +4927,443 @@ define([
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
- dialect: 'generic',
|
|
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['ASC', 'DESC', 'LIMIT']
|
|
|
|
|
|
|
+ suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT', 'OFFSET', 'UNION']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |, bla"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
- afterCursor: ', bla',
|
|
|
|
|
- containsKeywords: ['ASC', 'DESC'],
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- describe('Impala specific', function () {
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |, bla"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
+ afterCursor: ', bla',
|
|
|
dialect: 'impala',
|
|
dialect: 'impala',
|
|
|
|
|
+ containsKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST'],
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT']
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY 1 |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ASC NULLS |, bla"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY 1 ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ASC NULLS ',
|
|
|
|
|
+ afterCursor: ', bla',
|
|
|
dialect: 'impala',
|
|
dialect: 'impala',
|
|
|
|
|
+ containsKeywords: ['FIRST', 'LAST'],
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT']
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo NULLS |"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo NULLS ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
- dialect: 'impala',
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['FIRST', 'LAST']
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ describe('CLUSTER BY, DISTRIBUTE BY and SORT BY', function () {
|
|
|
|
|
+ describe('Hive specific', function () {
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM t1 ORDER BY foo ASC |', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 ORDER BY foo ASC ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'hive',
|
|
|
|
|
+ containsKeywords: ['CLUSTER BY', 'DISTRIBUTE BY', 'SORT BY', 'LIMIT'],
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
- afterCursor: '',
|
|
|
|
|
- dialect: 'impala',
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST', 'LIMIT']
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar |, bla"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ',
|
|
|
|
|
- afterCursor: ', bla',
|
|
|
|
|
- dialect: 'impala',
|
|
|
|
|
- containsKeywords: ['ASC', 'DESC', 'NULLS FIRST', 'NULLS LAST'],
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ASC NULLS |, bla"', function() {
|
|
|
|
|
- assertAutoComplete({
|
|
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable ORDER BY foo DESC, bar ASC NULLS ',
|
|
|
|
|
- afterCursor: ', bla',
|
|
|
|
|
- dialect: 'impala',
|
|
|
|
|
- containsKeywords: ['FIRST', 'LAST'],
|
|
|
|
|
- hasLocations: true,
|
|
|
|
|
- expectedResult: {
|
|
|
|
|
- lowerCase: false
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM t1 ORDER BY foo ASC CLUSTER BY a |', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 ORDER BY foo ASC CLUSTER BY a ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'hive',
|
|
|
|
|
+ containsKeywords: ['LIMIT'],
|
|
|
|
|
+ doesNotContainKeywords: ['DISTRIBUTE BY', 'SORT BY'],
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
|
|
|
|
|
- describe('GROUP BY Clause', function () {
|
|
|
|
|
- it('should suggest keywords for "SELECT * FROM testTable GROUP |"', function () {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM t1 ORDER BY foo ASC DISTRIBUTE BY a |', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM testTable GROUP ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 ORDER BY foo ASC DISTRIBUTE BY a ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
|
|
+ dialect: 'hive',
|
|
|
|
|
+ containsKeywords: ['SORT BY', 'LIMIT'],
|
|
|
|
|
+ doesNotContainKeywords: ['CLUSTER BY', 'DISTRIBUTE BY'],
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['BY']
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest identifiers for "SELECT * FROM testTableA tta, testTableB GROUP BY |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM t1 ORDER BY foo ASC SORT BY a DESC |', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 ORDER BY foo ASC SORT BY a DESC ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
- dialect: 'generic',
|
|
|
|
|
|
|
+ dialect: 'hive',
|
|
|
|
|
+ containsKeywords: ['LIMIT'],
|
|
|
|
|
+ doesNotContainKeywords: ['CLUSTER BY', 'DISTRIBUTE BY', 'NULLS FIRST', 'SORT BY'],
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
- expectedResult : {
|
|
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ describe('GROUP BY Clause', function () {
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM testTable GROUP |"', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTable GROUP ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['BY']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest identifier for "SELECT * FROM testTableA tta, testTableB GROUP BY bla, |"', function() {
|
|
|
|
|
|
|
+ it('should suggest identifiers for "SELECT * FROM testTableA tta, testTableB GROUP BY |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult : {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest identifier for "SELECT * FROM testTableA tta, testTableB GROUP BY bla, |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY bla, ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult : {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest identifier for "SELECT * FROM testTableA tta, testTableB GROUP BY bla, |, foo"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY bla, ',
|
|
|
|
|
+ afterCursor: ', foo',
|
|
|
|
|
+ dialect: 'generic',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult : {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM testTable GROUP BY |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM testTable GROUP BY ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest columns for "SELECT * FROM database_two.testTable GROUP BY |"', function() {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM database_two.testTable GROUP BY ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ describe('HAVING clause', function () {
|
|
|
|
|
+ describe('Hive specific', function () {
|
|
|
|
|
+ it('should suggest identifiers for "SELECT COUNT(*) AS boo FROM testTable GROUP BY baa HAVING |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY bla, ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT COUNT(*) AS boo FROM testTable GROUP BY baa HAVING ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
- dialect: 'generic',
|
|
|
|
|
|
|
+ dialect: 'hive',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
- expectedResult : {
|
|
|
|
|
|
|
+ expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
|
|
+ suggestFunctions: {},
|
|
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest identifier for "SELECT * FROM testTableA tta, testTableB GROUP BY bla, |, foo"', function() {
|
|
|
|
|
|
|
+ describe('Impala specific', function () {
|
|
|
|
|
+ it('should suggest identifiers for "SELECT COUNT(*) AS boo FROM testTable GROUP BY baa HAVING |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM testTableA tta, testTableB GROUP BY bla, ',
|
|
|
|
|
- afterCursor: ', foo',
|
|
|
|
|
- dialect: 'generic',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT COUNT(*) AS boo FROM testTable GROUP BY baa HAVING ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
- expectedResult : {
|
|
|
|
|
|
|
+ expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestIdentifiers: [{ name: 'tta.', type: 'alias' }, { name: 'testTableB.', type: 'table' }]
|
|
|
|
|
|
|
+ suggestFunctions: {},
|
|
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
|
|
+ suggestColumns: { table: 'testTable' }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM testTable GROUP BY |"', function() {
|
|
|
|
|
|
|
+ describe('OFFSET clause', function () {
|
|
|
|
|
+ describe('Impala specific', function () {
|
|
|
|
|
+ it('should handle "SELECT COUNT(*) AS boo FROM testTable GROUP BY baa OFFSET 1;|"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM testTable GROUP BY ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT COUNT(*) AS boo FROM testTable GROUP BY baa OFFSET 1; ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestColumns: { table: 'testTable' }
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT * FROM database_two.testTable GROUP BY |"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "SELECT COUNT(*) AS boo FROM testTable GROUP BY baa LIMIT 10 |"', function() {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT * FROM database_two.testTable GROUP BY ',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT COUNT(*) AS boo FROM testTable GROUP BY baa LIMIT 10 ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
|
|
+ dialect: 'impala',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ containsKeywords: ['OFFSET'],
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestColumns: { database: 'database_two', table: 'testTable' }
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT t1.testTableColumn1, t2.testTableColumn3 FROM testTable1 t1 JOIN testTable2 t2 ON t1.|"', function() {
|
|
|
|
|
|
|
+ describe('UNION clause', function () {
|
|
|
|
|
+ // TODO: Fix locations
|
|
|
|
|
+ xit('should handle "SELECT * FROM (SELECT x FROM few_ints UNION ALL SELECT x FROM few_ints) AS t1 ORDER BY x;|', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT t1.testTableColumn1, t2.testTableColumn3 FROM testTable1 t1 JOIN testTable2 t2 ON t1.',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM (SELECT x FROM few_ints UNION ALL SELECT x FROM few_ints) AS t1 ORDER BY x;',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestColumns: { table: 'testTable1' }
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT b.| FROM dbOne.foo f JOIN dbOne.bar b"', function() {
|
|
|
|
|
|
|
+ it('should handle "SELECT key FROM (SELECT key FROM src ORDER BY key LIMIT 10)subq1 UNION SELECT key FROM (SELECT key FROM src1 ORDER BY key LIMIT 10)subq2;|', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT b.',
|
|
|
|
|
- afterCursor: ' FROM dbOne.foo f JOIN dbOne.bar b',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT key FROM (SELECT key FROM src ORDER BY key LIMIT 10)subq1 UNION SELECT key FROM (SELECT key FROM src1 ORDER BY key LIMIT 10)subq2;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
- dialect: 'impala',
|
|
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
- lowerCase: false,
|
|
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'bar', database: 'dbOne' }
|
|
|
|
|
|
|
+ lowerCase: false
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT t1.testTableColumn1, t2.testTableColumn3 FROM database_two.testTable1 t1 JOIN testTable2 t2 ON t1.|"', function() {
|
|
|
|
|
|
|
+ it('should handle "SELECT * FROM t1 UNION DISTINCT SELECT * FROM t2;|', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT t1.testTableColumn1, t2.testTableColumn3 FROM database_two.testTable1 t1 JOIN testTable2 t2 ON t1.',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 UNION DISTINCT SELECT * FROM t2;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should handle "SELECT * FROM t1 UNION SELECT * FROM t2;|', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 UNION SELECT * FROM t2;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "SELECT * FROM t1 UNION |', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 UNION ',
|
|
|
afterCursor: '',
|
|
afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestColumns: { table: 'testTable1', database: 'database_two' }
|
|
|
|
|
|
|
+ suggestKeywords: ['ALL', 'DISTINCT', 'SELECT']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT testTable.| FROM testTable"', function() {
|
|
|
|
|
|
|
+ it('should suggest tables for "SELECT * FROM t1 UNION ALL SELECT |', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT testTable.',
|
|
|
|
|
- afterCursor: ' FROM testTable',
|
|
|
|
|
|
|
+ beforeCursor: 'SELECT * FROM t1 UNION ALL SELECT ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'testTable' }
|
|
|
|
|
|
|
+ suggestKeywords: ['*', 'ALL', 'DISTINCT'],
|
|
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestFunctions: {},
|
|
|
|
|
+ suggestTables: {
|
|
|
|
|
+ prependQuestionMark: true,
|
|
|
|
|
+ prependFrom: true
|
|
|
|
|
+ },
|
|
|
|
|
+ suggestDatabases: {
|
|
|
|
|
+ prependQuestionMark: true,
|
|
|
|
|
+ prependFrom: true,
|
|
|
|
|
+ appendDot: true
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
|
|
|
- it('should suggest columns "SELECT tt.| FROM testTable tt"', function() {
|
|
|
|
|
|
|
+ describe('WITH clause', function () {
|
|
|
|
|
+ it('should handle "WITH q1 AS ( SELECT key FROM src WHERE something) SELECT * FROM q1;|', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT tt.',
|
|
|
|
|
- afterCursor: ' FROM testTable tt',
|
|
|
|
|
|
|
+ beforeCursor: 'WITH q1 AS ( SELECT key FROM src WHERE something) SELECT * FROM q1;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should handle "WITH q1 AS (SELECT * FROM src WHERE something), q2 AS (SELECT * FROM src s2 WHERE something) SELECT * FROM q1 UNION ALL SELECT * FROM q2;|', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'WITH q1 AS (SELECT * FROM src WHERE something), q2 AS (SELECT * FROM src s2 WHERE something) SELECT * FROM q1 UNION ALL SELECT * FROM q2;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should handle "WITH t1 AS (SELECT 1) (WITH t2 AS (SELECT 2) SELECT * FROM t2) UNION ALL SELECT * FROM t1;|', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'WITH t1 AS (SELECT 1) (WITH t2 AS (SELECT 2) SELECT * FROM t2) UNION ALL SELECT * FROM t1;',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
|
|
+ containsKeywords: ['SELECT'],
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "WITH t1 |', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'WITH t1 ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'testTable' }
|
|
|
|
|
|
|
+ suggestKeywords: ['AS']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT tt.| FROM database_two.testTable tt"', function() {
|
|
|
|
|
|
|
+ it('should suggest keywords for "WITH t1 AS (|', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT tt.',
|
|
|
|
|
- afterCursor: ' FROM database_two.testTable tt',
|
|
|
|
|
|
|
+ beforeCursor: 'WITH t1 AS (',
|
|
|
|
|
+ afterCursor: '',
|
|
|
|
|
+ expectedResult: {
|
|
|
|
|
+ lowerCase: false,
|
|
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest keywords for "WITH t1 AS (SELECT * FROM boo) |', function () {
|
|
|
|
|
+ assertAutoComplete({
|
|
|
|
|
+ beforeCursor: 'WITH t1 AS (SELECT * FROM boo) ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'testTable', database: 'database_two' }
|
|
|
|
|
|
|
+ suggestKeywords: ['SELECT']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- it('should suggest columns for "SELECT tta.| FROM testTableA tta, testTableB ttb"', function() {
|
|
|
|
|
|
|
+ it('should suggest identifiers for "WITH t1 AS (SELECT * FROM FOO) SELECT |', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT tta.',
|
|
|
|
|
- afterCursor: ' FROM testTableA tta, testTableB ttb',
|
|
|
|
|
|
|
+ beforeCursor: 'WITH t1 AS (SELECT * FROM FOO) SELECT ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'testTableA' }
|
|
|
|
|
|
|
+ suggestKeywords: ['*', 'ALL', 'DISTINCT'],
|
|
|
|
|
+ suggestAggregateFunctions: true,
|
|
|
|
|
+ suggestAnalyticFunctions: true,
|
|
|
|
|
+ suggestFunctions: {},
|
|
|
|
|
+ suggestTables: { prependQuestionMark: true, prependFrom: true },
|
|
|
|
|
+ suggestDatabases: { prependQuestionMark: true, prependFrom: true, appendDot:true },
|
|
|
|
|
+ suggestCommonTableExpressions: [{ name: 't1', prependFrom: true, prependQuestionMark:true }]
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ it('should suggest identifiers for "WITH t1 AS (SELECT * FROM FOO) SELECT * FROM |', function () {
|
|
|
assertAutoComplete({
|
|
assertAutoComplete({
|
|
|
- beforeCursor: 'SELECT ttb.',
|
|
|
|
|
- afterCursor: ' FROM testTableA tta, testTableB ttb',
|
|
|
|
|
|
|
+ beforeCursor: 'WITH t1 AS (SELECT * FROM FOO) SELECT * FROM ',
|
|
|
|
|
+ afterCursor: '',
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
|
|
+ noErrors: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['*'],
|
|
|
|
|
- suggestColumns: { table: 'testTableB' }
|
|
|
|
|
|
|
+ suggestTables: { },
|
|
|
|
|
+ suggestDatabases: { appendDot: true },
|
|
|
|
|
+ suggestCommonTableExpressions: [{ name: 't1' }]
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -5329,7 +5669,7 @@ define([
|
|
|
hasLocations: true,
|
|
hasLocations: true,
|
|
|
expectedResult: {
|
|
expectedResult: {
|
|
|
lowerCase: false,
|
|
lowerCase: false,
|
|
|
- suggestKeywords: ['FULL', 'FULL OUTER', 'INNER', 'LEFT', 'LEFT OUTER', 'ON', 'RIGHT', 'RIGHT OUTER']
|
|
|
|
|
|
|
+ suggestKeywords: ['ON', 'FULL', 'FULL OUTER', 'INNER', 'LEFT', 'LEFT OUTER', 'RIGHT', 'RIGHT OUTER']
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|