SQL: Regen grammar

Original commit: elastic/x-pack-elasticsearch@7cac9f5ea0
This commit is contained in:
Costin Leau 2018-02-15 22:33:09 +02:00
parent 90b1dec14b
commit 749d0e3880
7 changed files with 703 additions and 633 deletions

View File

@ -55,6 +55,7 @@ statement
| (DESCRIBE | DESC) tableIdentifier #showColumns | (DESCRIBE | DESC) tableIdentifier #showColumns
| SHOW FUNCTIONS (LIKE? pattern)? #showFunctions | SHOW FUNCTIONS (LIKE? pattern)? #showFunctions
| SHOW SCHEMAS #showSchemas | SHOW SCHEMAS #showSchemas
| SYS CATALOGS #sysCatalogs
| SYS TABLES (CATALOG LIKE? clusterPattern=pattern)? | SYS TABLES (CATALOG LIKE? clusterPattern=pattern)?
(LIKE? tablePattern=pattern)? (LIKE? tablePattern=pattern)?
(TYPE STRING (',' STRING)* )? #sysTables (TYPE STRING (',' STRING)* )? #sysTables

View File

@ -139,7 +139,9 @@ abstract class CommandBuilder extends LogicalPlanBuilder {
@Override @Override
public Object visitSysCatalogs(SysCatalogsContext ctx) { public Object visitSysCatalogs(SysCatalogsContext ctx) {
return new SysCatalogs(source(ctx)); return new SysCatalogs(source(ctx));
} @Override }
@Override
public SysTables visitSysTables(SysTablesContext ctx) { public SysTables visitSysTables(SysTablesContext ctx) {
List<IndexType> types = new ArrayList<>(); List<IndexType> types = new ArrayList<>();
for (TerminalNode string : ctx.STRING()) { for (TerminalNode string : ctx.STRING()) {

View File

@ -124,6 +124,18 @@ class SqlBaseBaseListener implements SqlBaseListener {
* <p>The default implementation does nothing.</p> * <p>The default implementation does nothing.</p>
*/ */
@Override public void exitShowSchemas(SqlBaseParser.ShowSchemasContext ctx) { } @Override public void exitShowSchemas(SqlBaseParser.ShowSchemasContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void enterSysCatalogs(SqlBaseParser.SysCatalogsContext ctx) { }
/**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/
@Override public void exitSysCatalogs(SqlBaseParser.SysCatalogsContext ctx) { }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -79,6 +79,13 @@ class SqlBaseBaseVisitor<T> extends AbstractParseTreeVisitor<T> implements SqlBa
* {@link #visitChildren} on {@code ctx}.</p> * {@link #visitChildren} on {@code ctx}.</p>
*/ */
@Override public T visitShowSchemas(SqlBaseParser.ShowSchemasContext ctx) { return visitChildren(ctx); } @Override public T visitShowSchemas(SqlBaseParser.ShowSchemasContext ctx) { return visitChildren(ctx); }
/**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/
@Override public T visitSysCatalogs(SqlBaseParser.SysCatalogsContext ctx) { return visitChildren(ctx); }
/** /**
* {@inheritDoc} * {@inheritDoc}
* *

View File

@ -116,6 +116,18 @@ interface SqlBaseListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
void exitShowSchemas(SqlBaseParser.ShowSchemasContext ctx); void exitShowSchemas(SqlBaseParser.ShowSchemasContext ctx);
/**
* Enter a parse tree produced by the {@code sysCatalogs}
* labeled alternative in {@link SqlBaseParser#statement}.
* @param ctx the parse tree
*/
void enterSysCatalogs(SqlBaseParser.SysCatalogsContext ctx);
/**
* Exit a parse tree produced by the {@code sysCatalogs}
* labeled alternative in {@link SqlBaseParser#statement}.
* @param ctx the parse tree
*/
void exitSysCatalogs(SqlBaseParser.SysCatalogsContext ctx);
/** /**
* Enter a parse tree produced by the {@code sysTables} * Enter a parse tree produced by the {@code sysTables}
* labeled alternative in {@link SqlBaseParser#statement}. * labeled alternative in {@link SqlBaseParser#statement}.

View File

@ -76,6 +76,13 @@ interface SqlBaseVisitor<T> extends ParseTreeVisitor<T> {
* @return the visitor result * @return the visitor result
*/ */
T visitShowSchemas(SqlBaseParser.ShowSchemasContext ctx); T visitShowSchemas(SqlBaseParser.ShowSchemasContext ctx);
/**
* Visit a parse tree produced by the {@code sysCatalogs}
* labeled alternative in {@link SqlBaseParser#statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSysCatalogs(SqlBaseParser.SysCatalogsContext ctx);
/** /**
* Visit a parse tree produced by the {@code sysTables} * Visit a parse tree produced by the {@code sysTables}
* labeled alternative in {@link SqlBaseParser#statement}. * labeled alternative in {@link SqlBaseParser#statement}.