@Test public void canNotParseAggregateFunctionWithWrongArgument() { assertThrows(SyntaxCheckException.class, () -> parser.parse("SELECT SUM() FROM test")); assertThrows(SyntaxCheckException.class, () -> parser.parse("SELECT AVG() FROM test")); assertThrows(SyntaxCheckException.class, () -> parser.parse("SELECT SUM(a,b) FROM test")); assertThrows(SyntaxCheckException.class, () -> parser.parse("SELECT AVG(a,b,c) FROM test")); }
public ParseTree parse(String query) { OpenDistroSQLLexer lexer = new OpenDistroSQLLexer(new CaseInsensitiveCharStream(query)); OpenDistroSQLParser parser = new OpenDistroSQLParser(new CommonTokenStream(lexer)); parser.addErrorListener(new SyntaxAnalysisErrorListener()); return parser.root(); }
SQLSyntaxParser { public ParseTree parse(String query) { OpenDistroSQLLexer lexer = new OpenDistroSQLLexer(new CaseInsensitiveCharStream(query)); OpenDistroSQLParser parser = new OpenDistroSQLParser(new CommonTokenStream(lexer)); parser.addErrorListener(new SyntaxAnalysisErrorListener()); return parser.root(); } }
SQLSyntaxParser { public ParseTree parse(String query) { OpenDistroSQLLexer lexer = new OpenDistroSQLLexer(new CaseInsensitiveCharStream(query)); OpenDistroSQLParser parser = new OpenDistroSQLParser(new CommonTokenStream(lexer)); parser.addErrorListener(new SyntaxAnalysisErrorListener()); return parser.root(); }  }
SQLSyntaxParser { public ParseTree parse(String query) { OpenDistroSQLLexer lexer = new OpenDistroSQLLexer(new CaseInsensitiveCharStream(query)); OpenDistroSQLParser parser = new OpenDistroSQLParser(new CommonTokenStream(lexer)); parser.addErrorListener(new SyntaxAnalysisErrorListener()); return parser.root(); }  ParseTree parse(String query); }
SQLSyntaxParser { public ParseTree parse(String query) { OpenDistroSQLLexer lexer = new OpenDistroSQLLexer(new CaseInsensitiveCharStream(query)); OpenDistroSQLParser parser = new OpenDistroSQLParser(new CommonTokenStream(lexer)); parser.addErrorListener(new SyntaxAnalysisErrorListener()); return parser.root(); }  ParseTree parse(String query);  }