src/main/java/org/apache/hadoop/hdfs/server/namenode/AbstractQueryEngine.java
@Override // QueryEngine
  public Map<String, Long> genericSumOrFindHistogram(
      Stream<INode> inodes,
      Function<INode, String> namingFunction,
      ToLongFunction<INode> dataFunction,
      String find) {
    String findOp;
    String findField;
    if (find != null && find.length() != 0) {
      String[] finds = find.split(":");
      findOp = finds[0];
      findField = finds[1];
      switch (findOp) {
        case "max":
          return genericMaxxingHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        case "min":
          return genericMinningHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        case "avg":
          return genericAvgingHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        default:
          throw new IllegalArgumentException(
              "findOp: " + findOp + ", is not a valid find. Check /finds for valid options.");
      }
    } else {
      return genericSummingHistogram(inodes, namingFunction, dataFunction::applyAsLong);
    }
  }
/**
   * Produces either Histogram for generic summarization or finding of max/min/avg.
   *
   * @param inodes inodes
   * @param namingFunction function to string
   * @param dataFunction function to long
   * @return histogram of sums
   */
Produces either Histogram for generic summarization or finding of max/min/avg.
@param inodes inodes
@param namingFunction function to string
@param dataFunction function to long
@return histogram of sums
Produces either Histogram for generic summarization or finding of max / min / avg . @param inodes inodes @param namingFunction function to string @param dataFunction function to long @return histogram of sums
@Override 
  public Map<String, Long> genericSumOrFindHistogram(
      Stream<INode> inodes,
      Function<INode, String> namingFunction,
      ToLongFunction<INode> dataFunction,
      String find) {
    String findOp;
    String findField;
    if (find != null && find.length() != 0) {
      String[] finds = find.split(":");
      findOp = finds[0];
      findField = finds[1];
      switch (findOp) {
        case "max":
          return genericMaxxingHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        case "min":
          return genericMinningHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        case "avg":
          return genericAvgingHistogram(
              inodes,
              namingFunction,
              Helper.convertToLongFunction(getFilterFunctionToLongForINode(findField)));
        default:
          throw new IllegalArgumentException(
              "findOp: " + findOp + ", is not a valid find. Check /finds for valid options.");
      }
    } else {
      return genericSummingHistogram(inodes, namingFunction, dataFunction::applyAsLong);
    }
  }
@ Override public Map < String , Long > genericSumOrFindHistogram ( Stream < INode > inodes , Function < INode , String > namingFunction , ToLongFunction < INode > dataFunction , String find ) { String findOp ; String findField ; if ( find != null && find . length ( ) != 0 ) { String [ ] finds = find . split ( ":" ) ; findOp = finds [ 0 ] ; findField = finds [ 1 ] ; switch ( findOp ) { case "max" : return genericMaxxingHistogram ( inodes , namingFunction , Helper . convertToLongFunction ( getFilterFunctionToLongForINode ( findField ) ) ) ; case "min" : return genericMinningHistogram ( inodes , namingFunction , Helper . convertToLongFunction ( getFilterFunctionToLongForINode ( findField ) ) ) ; case "avg" : return genericAvgingHistogram ( inodes , namingFunction , Helper . convertToLongFunction ( getFilterFunctionToLongForINode ( findField ) ) ) ; default : throw new IllegalArgumentException ( "findOp: " + findOp + ", is not a valid find. Check /finds for valid options." ) ; } } else { return genericSummingHistogram ( inodes , namingFunction , dataFunction :: applyAsLong ) ; } }
Produces either Histogram for generic summarization or finding of max/min/avg.
Produces either Histogram for generic summarization or finding of max / min / avg .
// QueryEngine