feat: use SLL mode (#269)
* feat: use SLL(*) PredictionMode for better performance * feat: optimize mysql grammar to fit SLL mode * feat: optimize postgre grammmar to fit SLL mode * feat: optimize spark grammar to fit SLL mode * test: correct unit tests * feat: optimize pgsql grammar
This commit is contained in:
@ -405,7 +405,11 @@ describe('Postgre SQL Syntax Suggestion', () => {
|
||||
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||
);
|
||||
expect(suggestion).not.toBeUndefined();
|
||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['column_name']);
|
||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([
|
||||
'table_name',
|
||||
'.',
|
||||
'column_name',
|
||||
]);
|
||||
});
|
||||
|
||||
test('Alter Table With Column', () => {
|
||||
@ -764,7 +768,11 @@ describe('Postgre SQL Syntax Suggestion', () => {
|
||||
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||
);
|
||||
expect(suggestion).not.toBeUndefined();
|
||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['columnname']);
|
||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([
|
||||
'tablename',
|
||||
'.',
|
||||
'columnname',
|
||||
]);
|
||||
});
|
||||
|
||||
test('Select With Column', () => {
|
||||
|
@ -9,10 +9,10 @@ describe('Spark SQL Listener Tests', () => {
|
||||
|
||||
const parseTree = parser.parse(sql);
|
||||
|
||||
test('Listener exitRelationPrimary', () => {
|
||||
test('Listener exitTableName', () => {
|
||||
let result = '';
|
||||
class MyListener implements SparkSqlParserListener {
|
||||
exitRelationPrimary = (ctx): void => {
|
||||
exitTableName = (ctx): void => {
|
||||
result = ctx.getText().toLowerCase();
|
||||
};
|
||||
visitTerminal() {}
|
||||
|
@ -11,7 +11,7 @@ describe('Spark SQL Visitor Tests', () => {
|
||||
console.error('Parse error:', error);
|
||||
});
|
||||
|
||||
test('Visitor visitRelationPrimary', () => {
|
||||
test('Visitor visitTableName', () => {
|
||||
class MyVisitor
|
||||
extends AbstractParseTreeVisitor<any>
|
||||
implements SparkSqlParserVisitor<any>
|
||||
@ -20,7 +20,7 @@ describe('Spark SQL Visitor Tests', () => {
|
||||
protected defaultResult() {
|
||||
return this.result;
|
||||
}
|
||||
visitRelationPrimary = (ctx): void => {
|
||||
visitTableName = (ctx): void => {
|
||||
this.result = ctx.getText().toLowerCase();
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user