Program: 168440
Project: 168440
Buggy source:
@Override protected TableMetadata provideTableMetadata(TableName tableName,ClusterName clusterName,Connection<MongoClient> connection) throws ConnectorException {
  DB db=connection.getNativeConnection().getDB(tableName.getCatalogName().getName());
  DBCollection collection=db.getCollection(tableName.getName());
  TableMetadataBuilder tableMetadataBuilder=new TableMetadataBuilder(tableName.getCatalogName().getName(),tableName.getName(),clusterName.getName());
  String sampleNumber=connection.getSessionObject(String.class,"String_Node_Str");
  if (sampleNumber == null) {
    sampleNumber=ConfigurationOptions.SAMPLE_PROBABILITY.getDefaultValue()[0];
  }
  boolean firstField=true;
  for (  Map.Entry<String,String> entry : DiscoverMetadataUtils.discoverFieldsWithType(collection,sampleNumber).entrySet()) {
    if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.TEXT));
    }
 else     if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.BOOLEAN));
    }
 else     if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.INT));
    }
 else {
      continue;
    }
    if (firstField) {
      tableMetadataBuilder.withPartitionKey(entry.getKey());
      firstField=false;
    }
  }
  for (  IndexMetadata indexMetadata : DiscoverMetadataUtils.discoverIndexes(collection)) {
    tableMetadataBuilder.withColumns(new ArrayList<ColumnMetadata>(indexMetadata.getColumns().values()));
    tableMetadataBuilder.addIndex(indexMetadata);
  }
  return tableMetadataBuilder.build();
}

Fixed version (ground truth):
@Override protected TableMetadata provideTableMetadata(TableName tableName,ClusterName clusterName,Connection<MongoClient> connection) throws ConnectorException {
  DB db=connection.getNativeConnection().getDB(tableName.getCatalogName().getName());
  DBCollection collection=db.getCollection(tableName.getName());
  TableMetadataBuilder tableMetadataBuilder=new TableMetadataBuilder(tableName.getCatalogName().getName(),tableName.getName(),clusterName.getName());
  String sampleNumber=connection.getSessionObject(String.class,"String_Node_Str");
  if (sampleNumber == null) {
    sampleNumber=ConfigurationOptions.SAMPLE_PROBABILITY.getDefaultValue()[0];
  }
  boolean firstField=true;
  for (  Map.Entry<String,String> entry : DiscoverMetadataUtils.discoverFieldsWithType(collection,sampleNumber).entrySet()) {
    if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.TEXT));
    }
 else     if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.BOOLEAN));
    }
 else     if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.DOUBLE));
    }
 else     if (entry.getValue().equals("String_Node_Str")) {
      tableMetadataBuilder.addColumn(entry.getKey(),new ColumnType(DataType.NATIVE));
    }
 else {
      continue;
    }
    if (firstField) {
      tableMetadataBuilder.withPartitionKey(entry.getKey());
      firstField=false;
    }
  }
  for (  IndexMetadata indexMetadata : DiscoverMetadataUtils.discoverIndexes(collection)) {
    tableMetadataBuilder.withColumns(new ArrayList<ColumnMetadata>(indexMetadata.getColumns().values()));
    tableMetadataBuilder.addIndex(indexMetadata);
  }
  return tableMetadataBuilder.build();
}