@Test public void normalSubstring() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("abcdefg"))); assertEquals("bcd", actual.getValue()); }
@Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; }
SubstringExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; } }
SubstringExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; } SubstringExpression(String alias, Expression[] expressions); }
SubstringExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; } SubstringExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias(); @Override boolean process(ExpressionContext context, QueryResult result, Pipeline next); @Override List<String> getColumnNames(List<String> inputColumns); }
SubstringExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = expressions[0].apply(context, input); return (value != null && value.isNonNull()) ? new StringExpressionResult(doSubstring(context, input, value.toString())) : NullExpressionResult.INSTANCE ; } SubstringExpression(String alias, Expression[] expressions); @Override ExpressionResult apply(ExpressionContext context, ExpressionResult input); @Override String alias(); @Override boolean process(ExpressionContext context, QueryResult result, Pipeline next); @Override List<String> getColumnNames(List<String> inputColumns);  }