class SpreadsheetMetadata implements ConnectorMetadata {

  @Override
  public List<SchemaTableName> listTables(ConnectorSession session, String schemaNameOrNull) {
    if (schemaNameOrNull == null) {
      Map<String, Path> schemaMap = getUgi(session).doAs(new MapSchemaNames(session.getUser()));
      Set<String> schemaSet = new TreeSet<>(schemaMap.keySet());
      Builder<SchemaTableName> builder = ImmutableList.builder();
      for (String schemaName : schemaSet) {
        builder.addAll(listTables(session, schemaName));
      }
      return builder.build();
    } else {
      Path spreadsheetBasePath = getSpreadsheetBasePath(session.getUser());
      Path filePath = getSpreadsheetFilePath(session, spreadsheetBasePath, schemaNameOrNull);
      SpreadsheetReader spreadSheetHelper = getUgi(session).doAs(
          new GetSpreadsheetHelper(_useFileCache, filePath, _configuration));
      List<String> tableNames = spreadSheetHelper.getTableNames();
      Builder<SchemaTableName> builder = ImmutableList.builder();
      for (String table : tableNames) {
        builder.add(new SchemaTableName(schemaNameOrNull, table));
      }
      return builder.build();
    }
  }

  public  SpreadsheetMetadata(UserGroupInformation ugi, Configuration configuration, Path basePath,
      String spreadsheetSubDir, boolean useFileCache, boolean proxyUser);

}