code: public static Histogram predHistogram(Histogram hist, Predicate pred) {
  		if (Double.compare(hist.recordsOutput(), 1.0) < 0)
  			return new Histogram(hist.fields());
  
  		// apply constant ranges
  		Map<String, ConstantRange> cRanges = new HashMap<String, ConstantRange>();
  		for (String fld : hist.fields()) {
  			ConstantRange cr = pred.constantRange(fld);
  			if (cr != null)
  				cRanges.put(fld, cr);
  		}
  		Histogram crHist = constantRangeHistogram(hist, cRanges);
  
  		// apply field joins
  		Histogram jfHist = crHist;
  		Deque<String> flds = new LinkedList<String>(jfHist.fields());
  		while (!flds.isEmpty()) {
  			String fld = flds.removeFirst();
  			Set<String> group = pred.joinFields(fld);
  			if (group != null) {
  				flds.removeAll(group);
  				group.add(fld);
  				jfHist = joinFieldsHistogram(jfHist, group);
  			}
  		}
  		return jfHist;
  	}
docs: Returns a histogram that, for each field, approximates the distribution
  of field values from the specified histogram satisfying the specified
  predicate.
  
  <p>
  Assumes that:
  <ul>
  <li>Equality selection always finds matching records</li>
  <li>Values in a bucket have the same frequency (uniform frequency)</li>
  <li>Given values within two equal ranges (of two joinable fields), all
  values in the range having smaller number of values appear in the range
  having larger number of values</li>
  <li>Distributions of values in different fields are independent with each
  other</li>
  </ul>
  
  @param hist
  the input join distribution of field values
  @param pred
  the predicate
  @return a histogram that, for each field, approximates the distribution
  of field values satisfying the predicate