File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
main/java/org/nlpcn/es4sql/parse
test/java/org/nlpcn/es4sql Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ else if(lexer.token() == Token.LBRACKET){
68
68
lexer .nextToken ();
69
69
String prefix = "" ;
70
70
while (lexer .token ()!=Token .RBRACKET ){
71
- if (lexer .token () != Token .IDENTIFIER && lexer .token ()!=Token .INDEX ){
71
+ if (lexer .token () != Token .IDENTIFIER && lexer .token ()!=Token .INDEX && lexer . token ()!= Token . LITERAL_CHARS ){
72
72
throw new ParserException ("All items between Brackets should be identifiers , got:" +lexer .token ());
73
73
}
74
74
identifier .append (prefix );
Original file line number Diff line number Diff line change @@ -756,7 +756,17 @@ public void scriptOnFilterWithParams() throws SqlParseException {
756
756
757
757
}
758
758
759
-
759
+ @ Test
760
+ public void fieldsAsNumbersOnWhere () throws SqlParseException {
761
+ String query = "select * from x where ['3'] > 2" ;
762
+ Select select = parser .parseSelect ((SQLQueryExpr ) queryToExpr (query ));
763
+ LinkedList <Where > wheres = select .getWhere ().getWheres ();
764
+ Assert .assertEquals (1 , wheres .size ());
765
+ Where where = wheres .get (0 );
766
+ Assert .assertEquals (Condition .class ,where .getClass ());
767
+ Condition condition = (Condition ) where ;
768
+ int i =1 ;
769
+ }
760
770
761
771
private SQLExpr queryToExpr (String query ) {
762
772
return new ElasticSqlExprParser (query ).expr ();
You can’t perform that action at this time.
0 commit comments