@Test public void nonMatch() { ExpressionResult actual = testSubject.apply(expressionContext, mapValue("value", stringValue("abcdefg"), "pattern", stringValue("b.*g"))); assertFalse( actual.isTrue()); }
@Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return BooleanExpressionResult.forValue(false); ExpressionResult pattern = patternExpression.apply(context, input); return BooleanExpressionResult.forValue(value.toString().matches(pattern.toString())); }
MatchExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return BooleanExpressionResult.forValue(false); ExpressionResult pattern = patternExpression.apply(context, input); return BooleanExpressionResult.forValue(value.toString().matches(pattern.toString())); } }
MatchExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return BooleanExpressionResult.forValue(false); ExpressionResult pattern = patternExpression.apply(context, input); return BooleanExpressionResult.forValue(value.toString().matches(pattern.toString())); } MatchExpression(String alias, Expression[] expressions); }
MatchExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return BooleanExpressionResult.forValue(false); ExpressionResult pattern = patternExpression.apply(context, input); return BooleanExpressionResult.forValue(value.toString().matches(pattern.toString())); } MatchExpression(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); }
MatchExpression implements Expression, PipeExpression { @Override public ExpressionResult apply(ExpressionContext context, ExpressionResult input) { ExpressionResult value = valueExpression.apply(context, input); if( value == null || ! value.isNonNull() ) return BooleanExpressionResult.forValue(false); ExpressionResult pattern = patternExpression.apply(context, input); return BooleanExpressionResult.forValue(value.toString().matches(pattern.toString())); } MatchExpression(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);  }