docs: public Result run(Database database, Relation<O> relation) {
      if(queries == null) {
        throw new AbortException("A query set is required for this 'run' method.");
      }
      // Get a distance and kNN query instance.
      DistanceQuery<O> distQuery = database.getDistanceQuery(relation, getDistanceFunction());
      RangeQuery<O> rangeQuery = database.getRangeQuery(distQuery);
      NumberVector.Factory<O> ofactory = RelationUtil.getNumberVectorFactory(relation);
      int dim = RelationUtil.dimensionality(relation);
  
      // Separate query set.
      TypeInformation res = VectorFieldTypeInformation.typeRequest(NumberVector.class, dim + 1, dim + 1);
      MultipleObjectsBundle bundle = queries.loadData();
      int col = -1;
      for(int i = 0; i < bundle.metaLength(); i++) {
        if(res.isAssignableFromType(bundle.meta(i))) {
          col = i;
          break;
        }
      }
      if(col < 0) {
        StringBuilder buf = new StringBuilder();
        buf.append("No compatible data type in query input was found. Expected: ");
        buf.append(res.toString());
        buf.append(" have: ");
        for(int i = 0; i < bundle.metaLength(); i++) {
          if(i > 0) {
            buf.append(' ');
          }
          buf.append(bundle.meta(i).toString());
        }
        throw new IncompatibleDataException(buf.toString());
      }
      // Random sampling is a bit of hack, sorry.
      // But currently, we don't (yet) have an "integer random sample" function.
      DBIDRange sids = DBIDUtil.generateStaticDBIDRange(bundle.dataLength());
  
      final DBIDs sample = DBIDUtil.randomSample(sids, sampling, random);
      FiniteProgress prog = LOG.isVeryVerbose() ? new FiniteProgress("kNN queries", sample.size(), LOG) : null;
      int hash = 0;
      MeanVariance mv = new MeanVariance();
      double[] buf = new double[dim];
      for(DBIDIter iditer = sample.iter(); iditer.valid(); iditer.advance()) {
        int off = sids.binarySearch(iditer);
        assert (off >= 0);
        NumberVector o = (NumberVector) bundle.data(off, col);
        for(int i = 0; i < dim; i++) {
          buf[i] = o.doubleValue(i);
        }
        O v = ofactory.newNumberVector(buf);
        double r = o.doubleValue(dim);
        DoubleDBIDList rres = rangeQuery.getRangeForObject(v, r);
        int ichecksum = 0;
        for(DBIDIter it = rres.iter(); it.valid(); it.advance()) {
          ichecksum += DBIDUtil.asInteger(it);
        }
        hash = Util.mixHashCodes(hash, ichecksum);
        mv.put(rres.size());
        LOG.incrementProcessed(prog);
      }
      LOG.ensureCompleted(prog);
      if(LOG.isStatistics()) {
        LOG.statistics("Result hashcode: " + hash);
        LOG.statistics("Mean number of results: " + mv.getMean() + " +- " + mv.getNaiveStddev());
      }
      return null;
    }