Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/org/nlpcn/es4sql/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static void main(String[] args) throws Exception {
"group by key ";
String TEST_INDEX = "elasticsearch-sql_test_index";

sql = "select count(t.*) as counts,sum(t.size) from xxx/locs as t group by t.kk";
sql = "select * from xxx/locs where 'a' = 'b' and a > 1";

System.out.println("sql" + sql + ":\n----------\n" + sqlToEsQuery(sql));

Expand Down
6 changes: 5 additions & 1 deletion src/main/java/org/nlpcn/es4sql/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ public static Object removeTableAilasFromField(Object expr, String tableAlias) {


public static Object expr2Object(SQLExpr expr) {
return expr2Object(expr, "");
}

public static Object expr2Object(SQLExpr expr, String charWithQuote) {
Object value = null;
if (expr instanceof SQLNumericLiteralExpr) {
value = ((SQLNumericLiteralExpr) expr).getNumber();
} else if (expr instanceof SQLCharExpr) {
value = ((SQLCharExpr) expr).getText();
value = charWithQuote + ((SQLCharExpr) expr).getText() + charWithQuote;
} else if (expr instanceof SQLIdentifierExpr) {
value = expr.toString();
} else if (expr instanceof SQLPropertyExpr) {
Expand Down
Loading