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 @@ -759,7 +759,17 @@ public void scriptOnFilterWithParams() throws SqlParseException {
759
759
760
760
}
761
761
762
-
762
+ @ Test
763
+ public void fieldsAsNumbersOnWhere () throws SqlParseException {
764
+ String query = "select * from x where ['3'] > 2" ;
765
+ Select select = parser .parseSelect ((SQLQueryExpr ) queryToExpr (query ));
766
+ LinkedList <Where > wheres = select .getWhere ().getWheres ();
767
+ Assert .assertEquals (1 , wheres .size ());
768
+ Where where = wheres .get (0 );
769
+ Assert .assertEquals (Condition .class ,where .getClass ());
770
+ Condition condition = (Condition ) where ;
771
+ int i =1 ;
772
+ }
763
773
764
774
private SQLExpr queryToExpr (String query ) {
765
775
return new ElasticSqlExprParser (query ).expr ();
You can’t perform that action at this time.
0 commit comments