Skip to content

Commit

Permalink
Update missed valueOf calls in prometheus
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Nov 9, 2022
1 parent ef69e7e commit f479a60
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ private PrometheusQueryRequest buildQueryFromQueryRangeFunction(List<Expression>
arguments.forEach(arg -> {
String argName = ((NamedArgumentExpression) arg).getArgName();
Expression argValue = ((NamedArgumentExpression) arg).getValue();
ExprValue literalValue = argValue.valueOf(null);
ExprValue literalValue = argValue.valueOf();
switch (argName) {
case QUERY:
prometheusQueryRequest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public Void visitFunction(FunctionExpression func, Object context) {
ReferenceExpression ref = (ReferenceExpression) func.getArguments().get(0);
Expression rightExpr = func.getArguments().get(1);
if (ref.getAttr().equals("@timestamp")) {
ExprValue literalValue = rightExpr.valueOf(null);
ExprValue literalValue = rightExpr.valueOf();
if (func.getFunctionName().getFunctionName().contains(">")) {
startTime = literalValue.timestampValue().toEpochMilli() / 1000;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ void testValueOfAndTypeAndToString() {
QueryRangeFunctionImplementation queryRangeFunctionImplementation
= new QueryRangeFunctionImplementation(functionName, namedArgumentExpressionList, client);
UnsupportedOperationException exception = assertThrows(UnsupportedOperationException.class,
() -> queryRangeFunctionImplementation.valueOf(null));
() -> queryRangeFunctionImplementation.valueOf());
assertEquals("Prometheus defined function [query_range] is only "
+ "supported in SOURCE clause with prometheus connector catalog", exception.getMessage());
assertEquals("query_range(query=\"http_latency\", starttime=12345, endtime=12345, step=14)",
Expand Down

0 comments on commit f479a60

Please sign in to comment.