private static Set<String> getTableNames(DataSource dataSource) {
    if (dataSource == null) {
      return null;
    } else if (dataSource.getSubquery() != null) {
      return getTableNames(dataSource.getSubquery());
    } else if (dataSource.isSetJoin()) {
      return ImmutableSet.<String>builder().addAll(getTableNames(dataSource.getJoin().getLeft()))
          .addAll(getTableNames(dataSource.getJoin().getLeft())).build();
    }
    return ImmutableSet.of(dataSource.getTableName());
  }
@Test(dataProvider = "queryProvider")
  public void testResolveTableNames(String query, Set<String> expectedSet) {
    SqlNodeAndOptions sqlNodeAndOptions = CalciteSqlParser.compileToSqlNodeAndOptions(query);
    Set<String> tableNames =
        RequestUtils.getTableNames(CalciteSqlParser.compileSqlNodeToPinotQuery(sqlNodeAndOptions.getSqlNode()));

    if (expectedSet == null) {
      assertNull(tableNames);
    } else {
      assertEquals(tableNames, expectedSet);
    }
  }