### Question:
PushTopNIntoTableScan implements Rule<TopNNode> { public PushTopNIntoTableScan(Metadata metadata) { this.metadata = metadata; } PushTopNIntoTableScan(Metadata metadata); @Override Pattern<TopNNode> getPattern(); @Override Result apply(TopNNode topNNode, Captures captures, Context context);  }### Answer:
@Test public void testPushTopNIntoTableScan() { try (RuleTester ruleTester = defaultRuleTester()) { MockConnectorTableHandle connectorHandle = new MockConnectorTableHandle(TEST_SCHEMA_TABLE); MockConnectorFactory.ApplyTopN applyTopN = (session, handle, topNCount, sortItems, tableAssignments) -> Optional.of(new TopNApplicationResult<>(connectorHandle, true)); MockConnectorFactory mockFactory = createMockFactory(assignments, Optional.of(applyTopN)); ruleTester.getQueryRunner().createCatalog(MOCK_CATALOG, mockFactory, ImmutableMap.of()); ruleTester.assertThat(new PushTopNIntoTableScan(ruleTester.getMetadata())) .on(p -> { Symbol dimension = p.symbol(dimensionName, VARCHAR); Symbol metric = p.symbol(metricName, BIGINT); return p.topN(1, ImmutableList.of(dimension), p.tableScan(TEST_TABLE_HANDLE, ImmutableList.of(dimension, metric), ImmutableMap.of( dimension, dimensionColumn, metric, metricColumn))); }) .withSession(MOCK_SESSION) .matches( tableScan( equalTo(connectorHandle), TupleDomain.all(), new HashMap<>())); } }