-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
96 changed files
with
1,319 additions
and
788 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
104 changes: 0 additions & 104 deletions
104
...rc/main/java/org/elasticsearch/dsl/parser/query/method/AbstractAtomMethodQueryParser.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 58 additions & 9 deletions
67
...-query-core/src/main/java/org/elasticsearch/dsl/parser/query/method/MethodInvocation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,76 @@ | ||
package org.elasticsearch.dsl.parser.query.method; | ||
|
||
import com.alibaba.druid.sql.ast.SQLExpr; | ||
import com.alibaba.druid.sql.ast.expr.SQLMethodInvokeExpr; | ||
import org.elasticsearch.dsl.helper.ElasticSqlArgTransferHelper; | ||
|
||
import java.util.List; | ||
|
||
public class MethodInvocation { | ||
private SQLMethodInvokeExpr matchQueryExpr; | ||
private String queryAs; | ||
private Object[] sqlArgs; | ||
private final SQLMethodInvokeExpr methodInvokeExpr; | ||
private final String queryAs; | ||
private final Object[] sqlArgs; | ||
|
||
public MethodInvocation(SQLMethodInvokeExpr matchQueryExpr, String queryAs, Object[] sqlArgs) { | ||
this.matchQueryExpr = matchQueryExpr; | ||
public MethodInvocation(SQLMethodInvokeExpr methodInvokeExpr, String queryAs, Object[] sqlArgs) { | ||
if (methodInvokeExpr == null) { | ||
throw new IllegalArgumentException("method invoke expression can not be null"); | ||
} | ||
this.methodInvokeExpr = methodInvokeExpr; | ||
this.queryAs = queryAs; | ||
this.sqlArgs = sqlArgs; | ||
} | ||
|
||
public SQLMethodInvokeExpr getMatchQueryExpr() { | ||
return matchQueryExpr; | ||
} | ||
|
||
public String getQueryAs() { | ||
return queryAs; | ||
} | ||
|
||
public Object[] getSqlArgs() { | ||
return sqlArgs; | ||
} | ||
|
||
public String getMethodName() { | ||
return methodInvokeExpr.getMethodName(); | ||
} | ||
|
||
public List<SQLExpr> getParameters() { | ||
return methodInvokeExpr.getParameters(); | ||
} | ||
|
||
public int getParameterCount() { | ||
return methodInvokeExpr.getParameters().size(); | ||
} | ||
|
||
public SQLExpr getFirstParameter(int index) { | ||
return getParameter(0); | ||
} | ||
|
||
public SQLExpr getParameter(int index) { | ||
return methodInvokeExpr.getParameters().get(index); | ||
} | ||
|
||
public Object getParameterAsObject(int index) { | ||
SQLExpr paramExpr = methodInvokeExpr.getParameters().get(index); | ||
return ElasticSqlArgTransferHelper.transferSqlArg(paramExpr, sqlArgs, false); | ||
} | ||
|
||
public String getParameterAsFormatDate(int index) { | ||
SQLExpr paramExpr = methodInvokeExpr.getParameters().get(index); | ||
return ElasticSqlArgTransferHelper.transferSqlArg(paramExpr, sqlArgs, true).toString(); | ||
} | ||
|
||
public String getParameterAsString(int index) { | ||
return getParameterAsObject(index).toString(); | ||
} | ||
|
||
public String getLastParameterAsString() { | ||
return getParameterAsObject(getParameterCount() - 1).toString(); | ||
} | ||
|
||
public Double getParameterAsDouble(int index) { | ||
return (Double) getParameterAsObject(index); | ||
} | ||
|
||
public Long getParameterAsLong(int index) { | ||
return (Long) getParameterAsObject(index); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.