@Test public void betweenAnd(){ long now=System.currentTimeMillis(); String sql="select distinct name from student where a between 'dfsfsd' and 'ffff' aggregate by [apple,terms(a,1)],terms(b,1) limit 2,5"; ElasticSql2DslParser parser=new ElasticSql2DslParser(); ElasticSqlParseResult parseResult = parser.parse(sql); System.out.println(parseResult.toPrettyDsl(parseResult.getSearchRequest())); System.out.println(System.currentTimeMillis()-now); }
public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ parser.parse(elasticDslContext); } return elasticDslContext.getParseResult(); }
ElasticSql2DslParser { public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ parser.parse(elasticDslContext); } return elasticDslContext.getParseResult(); } }
ElasticSql2DslParser { public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ parser.parse(elasticDslContext); } return elasticDslContext.getParseResult(); }  }
ElasticSql2DslParser { public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ parser.parse(elasticDslContext); } return elasticDslContext.getParseResult(); }  ElasticSqlParseResult parse(String sql); }
ElasticSql2DslParser { public ElasticSqlParseResult parse(String sql) throws ElasticSql2DslException{ Walker walker=new Walker(sql); ElasticsearchParser.SqlContext sqlContext = walker.buildAntlrTree(); ElasticDslContext elasticDslContext=new ElasticDslContext(sqlContext); for(QueryParser parser:buildSqlParserChain()){ parser.parse(elasticDslContext); } return elasticDslContext.getParseResult(); }  ElasticSqlParseResult parse(String sql);  }