@Test public void process() { Map<String, ExpressionResult> map = new HashMap<>(); map.put("test2", new NumericExpressionResult(100)); map.put("test", new StringExpressionResult("String value")); QueryResult queryResult = new DefaultQueryResult(new MapExpressionResult(map)); testSubject.process(context, queryResult, value -> { assertThat(value.getValue()).isInstanceOf(MapExpressionResult.class); MapExpressionResult map1 = (MapExpressionResult)value.getValue(); assertThat(map1.getByIdentifier("sum")).isInstanceOf(NumericExpressionResult.class); assertThat(map1.getByIdentifier("test")).isInstanceOf(StringExpressionResult.class); return true; }); assertThat(testSubject.getColumnNames(Collections.emptyList())).containsSequence("test", "sum"); }
@Override public boolean process(ExpressionContext context, QueryResult result, Pipeline next) { Map<String, ExpressionResult> values = new HashMap<>(); for (Expression valueExpression : expressions) { values.put(valueExpression.alias(), valueExpression.apply(context, result.getValue())); } return next.process(result.withValue(new MapExpressionResult(values))); }
SelectExpression implements PipeExpression { @Override public boolean process(ExpressionContext context, QueryResult result, Pipeline next) { Map<String, ExpressionResult> values = new HashMap<>(); for (Expression valueExpression : expressions) { values.put(valueExpression.alias(), valueExpression.apply(context, result.getValue())); } return next.process(result.withValue(new MapExpressionResult(values))); } }
SelectExpression implements PipeExpression { @Override public boolean process(ExpressionContext context, QueryResult result, Pipeline next) { Map<String, ExpressionResult> values = new HashMap<>(); for (Expression valueExpression : expressions) { values.put(valueExpression.alias(), valueExpression.apply(context, result.getValue())); } return next.process(result.withValue(new MapExpressionResult(values))); } SelectExpression(Expression[] expressions); }
SelectExpression implements PipeExpression { @Override public boolean process(ExpressionContext context, QueryResult result, Pipeline next) { Map<String, ExpressionResult> values = new HashMap<>(); for (Expression valueExpression : expressions) { values.put(valueExpression.alias(), valueExpression.apply(context, result.getValue())); } return next.process(result.withValue(new MapExpressionResult(values))); } SelectExpression(Expression[] expressions); @Override boolean process(ExpressionContext context, QueryResult result, Pipeline next); @Override List<String> getColumnNames(List<String> inputColumns); }
SelectExpression implements PipeExpression { @Override public boolean process(ExpressionContext context, QueryResult result, Pipeline next) { Map<String, ExpressionResult> values = new HashMap<>(); for (Expression valueExpression : expressions) { values.put(valueExpression.alias(), valueExpression.apply(context, result.getValue())); } return next.process(result.withValue(new MapExpressionResult(values))); } SelectExpression(Expression[] expressions); @Override boolean process(ExpressionContext context, QueryResult result, Pipeline next); @Override List<String> getColumnNames(List<String> inputColumns);  }