All Downloads are FREE. Search and download functionalities are using the official Maven repository.

water.api.FindHandler Maven / Gradle / Ivy

There is a newer version: 3.8.2.9
Show newest version
package water.api;

import water.H2O;
import water.MRTask;
import water.exceptions.H2OColumnNotFoundArgumentException;
import water.exceptions.H2OCategoricalLevelNotFoundArgumentException;
import water.exceptions.H2OIllegalArgumentException;
import water.fvec.Chunk;
import water.fvec.Frame;
import water.fvec.Vec;
import water.util.ArrayUtils;
import water.util.IcedHashMap;

class FindHandler extends Handler {

  @SuppressWarnings("unused") // called through reflection by RequestServer
  public FindV3 find(int version, FindV3 find) {
    Frame frame = find.key._fr;
    // Peel out an optional column; restrict to this column
    if( find.column != null ) {
      Vec vec = frame.vec(find.column);
      if( vec==null ) throw new H2OColumnNotFoundArgumentException("column", frame, find.column);
      find.key = new FrameV3(new Frame(new String[]{find.column}, new Vec[]{vec}));
    }

    // Convert the search string into a column-specific flavor
    Vec[] vecs = frame.vecs();
    double ds[] = new double[vecs.length];
    for( int i=0; i {
    final long _row;
    final double[] _ds;
    long _prev, _next;
    Find( long row, double[] ds ) { 
      super((byte)(H2O.GUI_PRIORITY - 2));
      _row = row; _ds = ds; _prev = -1; _next = Long.MAX_VALUE; 
    }
    @Override public void map( Chunk cs[] ) {
      for( int col = 0; col _prev ) _prev = r; }
            else if( r > _row ) { if( r < _next ) _next = r; }
          }
        }
      }
    }
    @Override public void reduce( Find f ) {
      if( _prev < f._prev ) _prev = f._prev;
      if( _next > f._next ) _next = f._next;
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy