src/main/java/org/apache/hadoop/hdfs/server/namenode/AbstractQueryEngine.java
@Override // QueryEngine
  public Collection<INode> findFilter(Collection<INode> inodes, String find) {
    if (find == null || find.isEmpty()) {
      return inodes;
    }

    String[] findOps = find.split(":");
    Function<INode, Long> findToLong = getFilterFunctionToLongForINode(findOps[1]);

    long start = System.currentTimeMillis();
    Optional<INode> optional;
    try {
      Stream<INode> stream = inodes.parallelStream();
      switch (findOps[0]) {
        case "max":
          optional = stream.max(Comparator.comparingLong(findToLong::apply));
          break;
        case "min":
          optional = stream.min(Comparator.comparingLong(findToLong::apply));
          break;
        default:
          throw new IllegalArgumentException("Unknown find query type: " + findOps[0]);
      }
    } finally {
      long end = System.currentTimeMillis();
      LOG.info("Performing find: {} took: {} ms.", Arrays.asList(findOps), (end - start));
    }

    return optional.<Collection<INode>>map(Collections::singleton).orElseGet(Collections::emptySet);
  }
/**
   * Perform the find operation on a /filter endpoint call.
   *
   * @param inodes set of inodes to work on
   * @param find the find operation to perform
   * @return the result of the find operation
   */
Perform the find operation on a /filter endpoint call.
@param inodes set of inodes to work on
@param find the find operation to perform
@return the result of the find operation
Perform the find operation on a / filter endpoint call . @param inodes set of inodes to work on @param find the find operation to perform @return the result of the find operation
@Override 
  public Collection<INode> findFilter(Collection<INode> inodes, String find) {
    if (find == null || find.isEmpty()) {
      return inodes;
    }
    String[] findOps = find.split(":");
    Function<INode, Long> findToLong = getFilterFunctionToLongForINode(findOps[1]);
    long start = System.currentTimeMillis();
    Optional<INode> optional;
    try {
      Stream<INode> stream = inodes.parallelStream();
      switch (findOps[0]) {
        case "max":
          optional = stream.max(Comparator.comparingLong(findToLong::apply));
          break;
        case "min":
          optional = stream.min(Comparator.comparingLong(findToLong::apply));
          break;
        default:
          throw new IllegalArgumentException("Unknown find query type: " + findOps[0]);
      }
    } finally {
      long end = System.currentTimeMillis();
      LOG.info("Performing find: {} took: {} ms.", Arrays.asList(findOps), (end - start));
    }
    return optional.<Collection<INode>>map(Collections::singleton).orElseGet(Collections::emptySet);
  }
@ Override public Collection < INode > findFilter ( Collection < INode > inodes , String find ) { if ( find == null || find . isEmpty ( ) ) { return inodes ; } String [ ] findOps = find . split ( ":" ) ; Function < INode , Long > findToLong = getFilterFunctionToLongForINode ( findOps [ 1 ] ) ; long start = System . currentTimeMillis ( ) ; Optional < INode > optional ; try { Stream < INode > stream = inodes . parallelStream ( ) ; switch ( findOps [ 0 ] ) { case "max" : optional = stream . max ( Comparator . comparingLong ( findToLong :: apply ) ) ; break ; case "min" : optional = stream . min ( Comparator . comparingLong ( findToLong :: apply ) ) ; break ; default : throw new IllegalArgumentException ( "Unknown find query type: " + findOps [ 0 ] ) ; } } finally { long end = System . currentTimeMillis ( ) ; LOG . info ( "Performing find: {} took: {} ms." , Arrays . asList ( findOps ) , ( end - start ) ) ; } return optional . < Collection < INode > > map ( Collections :: singleton ) . orElseGet ( Collections :: emptySet ) ; }
Perform the find operation on a /filter endpoint call.
Perform the find operation on a / filter endpoint call .
// QueryEngine