Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2286659

Browse files
committed
semi colons allowed on index name NLPchina#166
1 parent 5c23320 commit 2286659

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/java/org/nlpcn/es4sql/parse/ElasticLexer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,6 @@ public void scanIdentifier() {
8888

8989

9090
private boolean isElasticIdentifierChar(char ch) {
91-
return ch == '*' || ch == ':' || ch == '-' || ch == '.' || isIdentifierChar(ch);
91+
return ch == '*' || ch == ':' || ch == '-' || ch == '.' || ch == ';' || isIdentifierChar(ch);
9292
}
9393
}

src/test/java/org/nlpcn/es4sql/SqlParserTests.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,14 +414,23 @@ public void innerQueryTestTwoQueries() throws SqlParseException {
414414
}
415415

416416
@Test
417-
public void indexWithDotsAndHyphen() throws SqlParseException {
417+
public void indexWithDotsAndHyphen() throws SqlParseException {
418418
String query = "select * from data-2015.08.22";
419419
SQLExpr sqlExpr = queryToExpr(query);
420420
Select select = parser.parseSelect((SQLQueryExpr) sqlExpr);
421421
Assert.assertEquals(1,select.getFrom().size());
422422
Assert.assertEquals("data-2015.08.22",select.getFrom().get(0).getIndex());
423423
}
424424

425+
@Test
426+
public void indexWithSemiColons() throws SqlParseException {
427+
String query = "select * from some;index";
428+
SQLExpr sqlExpr = queryToExpr(query);
429+
Select select = parser.parseSelect((SQLQueryExpr) sqlExpr);
430+
Assert.assertEquals(1,select.getFrom().size());
431+
Assert.assertEquals("some;index",select.getFrom().get(0).getIndex());
432+
}
433+
425434
@Test
426435
public void scriptFiledPlusLiteralTest() throws SqlParseException {
427436
String query = "SELECT field1 + 3 FROM index/type";

0 commit comments

Comments
 (0)