public FloatColumnPreIndexStatsCollector(String column, StatsCollectorConfig statsCollectorConfig) { super(column, statsCollectorConfig); rawFloatSet = new FloatOpenHashSet(INITIAL_HASH_SET_SIZE); aggregatedFloatSet = new FloatOpenHashSet(INITIAL_HASH_SET_SIZE); }
FloatRawValueBasedNotInPredicateEvaluator(NotInPredicate notInPredicate) { String[] values = notInPredicate.getValues(); _nonMatchingValues = new FloatOpenHashSet(HashUtil.getMinHashSetSize(values.length)); for (String value : values) { _nonMatchingValues.add(Float.parseFloat(value)); } }
FloatRawValueBasedInPredicateEvaluator(InPredicate inPredicate) { String[] values = inPredicate.getValues(); _matchingValues = new FloatOpenHashSet(HashUtil.getMinHashSetSize(values.length)); for (String value : values) { _matchingValues.add(Float.parseFloat(value)); } }
@Override public float[][] transformToFloatValuesMV(@Nonnull ProjectionBlock projectionBlock) { if (getResultMetadata().getDataType() != FieldSpec.DataType.FLOAT) { return super.transformToFloatValuesMV(projectionBlock); } if (_floatValueSet == null) { _floatValueSet = new FloatOpenHashSet(); for (String inValue : _stringValueSet) { _floatValueSet.add(Float.parseFloat(inValue)); } _floatValues = new float[DocIdSetPlanNode.MAX_DOC_PER_CALL][]; } float[][] unFilteredFloatValues = _mainTransformFunction.transformToFloatValuesMV(projectionBlock); int length = projectionBlock.getNumDocs(); for (int i = 0; i < length; i++) { _floatValues[i] = filterFloats(_floatValueSet, unFilteredFloatValues[i]); } return _floatValues; }
@Override public int countUnique() { FloatSet uniqueElements = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { uniqueElements.add(getFloat(i)); } } return uniqueElements.size(); }
@Override public FloatColumn unique() { final FloatSet values = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { values.add(getFloat(i)); } } final FloatColumn column = FloatColumn.create(name() + " Unique values"); for (float value : values) { column.append(value); } return column; }
@Test public void testFloatPredicateEvaluators() { List<String> stringValues = new ArrayList<>(NUM_PREDICATE_VALUES); FloatSet valueSet = new FloatOpenHashSet();
Arrays.sort(_longValues); FloatOpenHashSet floatSet = new FloatOpenHashSet(); while (floatSet.size() < NUM_VALUES) { floatSet.add(RANDOM.nextFloat());
FloatSet asSet() { return new FloatOpenHashSet(data); }
return new IntOpenHashSet(set); } else if (oCls.equals(Float.class)) { return new FloatOpenHashSet(set); } else if (oCls.equals(Double.class)) { return new DoubleOpenHashSet(set);
private Set deserializeSet(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectOpenHashSet set = new ObjectOpenHashSet(size); for (int i = 0; i < size; i++) { set.add(deserialize(is)); } return set; } else if (oCls.equals(int[].class)) { return new IntOpenHashSet((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatOpenHashSet((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleOpenHashSet((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortOpenHashSet((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteOpenHashSet((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongOpenHashSet((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanOpenHashSet((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharOpenHashSet((char[]) h); } throw new EOFException(); }
private Set deserializeSet(final DataInput is) throws IOException, ClassNotFoundException { Object h = deserialize(is); Class oCls = h.getClass(); if (oCls.equals(Integer.class)) { int size = (Integer) h; ObjectOpenHashSet set = new ObjectOpenHashSet(size); for (int i = 0; i < size; i++) { set.add(deserialize(is)); } return set; } else if (oCls.equals(int[].class)) { return new IntOpenHashSet((int[]) h); } else if (oCls.equals(float[].class)) { return new FloatOpenHashSet((float[]) h); } else if (oCls.equals(double[].class)) { return new DoubleOpenHashSet((double[]) h); } else if (oCls.equals(short[].class)) { return new ShortOpenHashSet((short[]) h); } else if (oCls.equals(byte[].class)) { return new ByteOpenHashSet((byte[]) h); } else if (oCls.equals(long[].class)) { return new LongOpenHashSet((long[]) h); } else if (oCls.equals(boolean[].class)) { return new BooleanOpenHashSet((boolean[]) h); } else if (oCls.equals(char[].class)) { return new CharOpenHashSet((char[]) h); } throw new EOFException(); }
@Override public int countUnique() { FloatSet floats = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { floats.add(data.getFloat(i)); } return floats.size(); }
return new IntOpenHashSet(set); } else if (oCls.equals(Float.class)) { return new FloatOpenHashSet(set); } else if (oCls.equals(Double.class)) { return new DoubleOpenHashSet(set);
@Override public int countUnique() { FloatSet uniqueElements = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { uniqueElements.add(getFloat(i)); } } return uniqueElements.size(); }
hs = new FloatOpenHashSet(); for (int k = 0; k < values.length(); k++) { hs.add((float) values.getDouble(k));
@Override public FloatColumn unique() { FloatSet floats = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { floats.add(data.getFloat(i)); } FloatColumn column = new FloatColumn(name() + " Unique values", floats.size()); floats.forEach(column::add); return column; }
@Override public FloatColumn unique() { final FloatSet values = new FloatOpenHashSet(); for (int i = 0; i < size(); i++) { if (!isMissing(i)) { values.add(getFloat(i)); } } final FloatColumn column = FloatColumn.create(name() + " Unique values"); for (float value : values) { column.append(value); } return column; }