<commit_before>package edu.umn.cs;

import java.util.HashMap;
import java.util.Map;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.spatial.CellInfo;

public class ReadFile {

  public static void main(String[] args) throws Exception {
    Configuration conf = new Configuration();
    Path inFile = new Path(args[0]);
    FileSystem fs = inFile.getFileSystem(conf);
    
    Map<CellInfo, Integer> blocks_per_cell = new HashMap<CellInfo, Integer>();
    int heap_blocks = 0;
    
    long length = fs.getFileStatus(inFile).getLen();
    
    BlockLocation[] fileBlockLocations = fs.getFileBlockLocations(fs.getFileStatus(inFile), 0, length);
    for (BlockLocation blk : fileBlockLocations) {
      if (blk.getCellInfo() != null) {
        if (blocks_per_cell.containsKey(blk.getCellInfo())) {
          int count = blocks_per_cell.get(blk.getCellInfo());
          blocks_per_cell.put(blk.getCellInfo(), count);
        } else {
          blocks_per_cell.put(blk.getCellInfo(), 1);
        }
      } else {
        heap_blocks++;
      }
    }
    if (blocks_per_cell.isEmpty()) {
      System.out.println("No spatial blocks");
    } else {
      for (Map.Entry<CellInfo, Integer> map_entry : blocks_per_cell.entrySet()) {
        System.out.println(map_entry.getKey()+" -- "+map_entry.getValue());
      }
    }
    if (heap_blocks == 0) {
      System.out.println("No heap blocks");
    } else {
      System.out.println(heap_blocks+" heap blocks");
    }
    
  }
}
<commit_msg>Fixed a bug with ReadFile causing the count to be always 1<commit_after>package edu.umn.cs;

import java.util.HashMap;
import java.util.Map;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.BlockLocation;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.spatial.CellInfo;

public class ReadFile {

  public static void main(String[] args) throws Exception {
    Configuration conf = new Configuration();
    Path inFile = new Path(args[0]);
    FileSystem fs = inFile.getFileSystem(conf);
    
    Map<CellInfo, Integer> blocks_per_cell = new HashMap<CellInfo, Integer>();
    int heap_blocks = 0;
    
    long length = fs.getFileStatus(inFile).getLen();
    
    BlockLocation[] fileBlockLocations = fs.getFileBlockLocations(fs.getFileStatus(inFile), 0, length);
    for (BlockLocation blk : fileBlockLocations) {
      if (blk.getCellInfo() != null) {
        if (blocks_per_cell.containsKey(blk.getCellInfo())) {
          int count = blocks_per_cell.get(blk.getCellInfo());
          blocks_per_cell.put(blk.getCellInfo(), count + 1);
        } else {
          blocks_per_cell.put(blk.getCellInfo(), 1);
        }
      } else {
        heap_blocks++;
      }
    }
    if (blocks_per_cell.isEmpty()) {
      System.out.println("No spatial blocks");
    } else {
      for (Map.Entry<CellInfo, Integer> map_entry : blocks_per_cell.entrySet()) {
        System.out.println(map_entry.getKey()+" -- "+map_entry.getValue());
      }
    }
    if (heap_blocks == 0) {
      System.out.println("No heap blocks");
    } else {
      System.out.println(heap_blocks+" heap blocks");
    }
    
  }
}

{'fraction_non_alphanumeric': 0.130804248861912, 'fraction_numerical': 0.0036418816388467377, 'mean_word_length': 3.109725685785536, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3369481', 'n_tokens_mistral': 1049, 'n_tokens_neox': 1038, 'n_words': 204}