public static Pattern<ExchangeNode> exchange() { return typeOf(ExchangeNode.class); }
public static Pattern<LateralJoinNode> lateralJoin() { return typeOf(LateralJoinNode.class); }
public static Pattern<SampleNode> sample() { return typeOf(SampleNode.class); }
public static Pattern<TableWriterNode> tableWriterNode() { return typeOf(TableWriterNode.class); }
public static Pattern<UnionNode> union() { return typeOf(UnionNode.class); }
public static Pattern<WindowNode> window() { return typeOf(WindowNode.class); }
public static Pattern<DeleteNode> delete() { return typeOf(DeleteNode.class); }
public static Pattern<EnforceSingleRowNode> enforceSingleRow() { return typeOf(EnforceSingleRowNode.class); }
public static Pattern<JoinNode> join() { return typeOf(JoinNode.class); }
public static Pattern<MarkDistinctNode> markDistinct() { return typeOf(MarkDistinctNode.class); }
public static Pattern<ProjectNode> project() { return typeOf(ProjectNode.class); }
public static Pattern<ValuesNode> values() { return typeOf(ValuesNode.class); }
public static Pattern<AggregationNode> aggregation() { return typeOf(AggregationNode.class); }
public static Pattern<SpatialJoinNode> spatialJoin() { return typeOf(SpatialJoinNode.class); }
@Override public Pattern<PlanNode> getPattern() { return Pattern.typeOf(PlanNode.class); }
public static Pattern<JoinNode> join() { return typeOf(JoinNode.class); }
public static Pattern<FilterNode> filter() { return typeOf(FilterNode.class); }
@Test public void matchAdditionalProperties() { String matchedValue = "A little string."; Pattern<String> pattern = typeOf(String.class) .matching(s -> s.startsWith("A")) .matching((CharSequence s) -> s.length() > 7); assertMatch(pattern, matchedValue); }
@Test public void nullNotMatchedByDefault() { assertNoMatch(any(), null); assertNoMatch(typeOf(Integer.class), null); }
@Test public void noMatchMeansNoCaptures() { Capture<Void> impossible = newCapture(); Pattern<Void> pattern = typeOf(Void.class).capturedAs(impossible); Match<Void> match = DefaultMatcher.DEFAULT_MATCHER.match(pattern, 42); assertTrue(match.isEmpty()); Throwable throwable = expectThrows(NoSuchElementException.class, () -> match.capture(impossible)); assertTrue(throwable.getMessage().contains("Captures are undefined for an empty Match")); }