@Test
  public void testRecordSetProvider() throws Exception {
    for (SchemaTableName schemaTableName : metadata.listTables(SESSION, "jmx")) {
      JmxTableHandle tableHandle = metadata.getTableHandle(SESSION, schemaTableName);
      List<ColumnHandle> columnHandles =
          ImmutableList.copyOf(metadata.getColumnHandles(SESSION, tableHandle).values());

      ConnectorTableLayoutHandle layout = new JmxTableLayoutHandle(tableHandle, TupleDomain.all());
      ConnectorSplitSource splitSource =
          splitManager.getSplits(JmxTransactionHandle.INSTANCE, SESSION, layout);
      List<ConnectorSplit> allSplits = getAllSplits(splitSource);
      assertEquals(allSplits.size(), nodes.size());
      ConnectorSplit split = allSplits.get(0);

      RecordSet recordSet =
          recordSetProvider.getRecordSet(
              JmxTransactionHandle.INSTANCE, SESSION, split, columnHandles);
      try (RecordCursor cursor = recordSet.cursor()) {
        while (cursor.advanceNextPosition()) {
          for (int i = 0; i < recordSet.getColumnTypes().size(); i++) {
            cursor.isNull(i);
          }
        }
      }
    }
  }
  @Test
  public void testNoPredicate() throws Exception {
    ConnectorTableLayoutHandle layout = new JmxTableLayoutHandle(tableHandle, TupleDomain.all());
    ConnectorSplitSource splitSource =
        splitManager.getSplits(JmxTransactionHandle.INSTANCE, SESSION, layout);
    List<ConnectorSplit> allSplits = getAllSplits(splitSource);
    assertEquals(allSplits.size(), nodes.size());

    Set<String> actualNodes = nodes.stream().map(Node::getNodeIdentifier).collect(toSet());
    Set<String> expectedNodes = new HashSet<>();
    for (ConnectorSplit split : allSplits) {
      List<HostAddress> addresses = split.getAddresses();
      assertEquals(addresses.size(), 1);
      expectedNodes.add(addresses.get(0).getHostText());
    }
    assertEquals(actualNodes, expectedNodes);
  }
  @Test
  public void testPredicatePushdown() throws Exception {
    for (Node node : nodes) {
      String nodeIdentifier = node.getNodeIdentifier();
      TupleDomain<ColumnHandle> nodeTupleDomain =
          TupleDomain.fromFixedValues(
              ImmutableMap.of(columnHandle, NullableValue.of(VARCHAR, utf8Slice(nodeIdentifier))));
      ConnectorTableLayoutHandle layout = new JmxTableLayoutHandle(tableHandle, nodeTupleDomain);

      ConnectorSplitSource splitSource =
          splitManager.getSplits(JmxTransactionHandle.INSTANCE, SESSION, layout);
      List<ConnectorSplit> allSplits = getAllSplits(splitSource);

      assertEquals(allSplits.size(), 1);
      assertEquals(allSplits.get(0).getAddresses().size(), 1);
      assertEquals(allSplits.get(0).getAddresses().get(0).getHostText(), nodeIdentifier);
    }
  }