Search in sources :

Example 6 with LongOpenHashSet

use of it.unimi.dsi.fastutil.longs.LongOpenHashSet in project symja_android_library by axkr.

the class InstantColumn method unique.

@Override
public InstantColumn unique() {
    LongSet ints = new LongOpenHashSet(data.size());
    for (long i : data) {
        ints.add(i);
    }
    InstantColumn column = emptyCopy(ints.size());
    column.setName(name() + " Unique values");
    column.data = LongArrayList.wrap(ints.toLongArray());
    return column;
}
Also used : LongSet(it.unimi.dsi.fastutil.longs.LongSet) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet)

Example 7 with LongOpenHashSet

use of it.unimi.dsi.fastutil.longs.LongOpenHashSet in project druid by druid-io.

the class InDimFilter method createLongPredicate.

private static DruidLongPredicate createLongPredicate(final Set<String> values) {
    LongArrayList longs = new LongArrayList(values.size());
    for (String value : values) {
        final Long longValue = DimensionHandlerUtils.convertObjectToLong(value);
        if (longValue != null) {
            longs.add((long) longValue);
        }
    }
    final LongOpenHashSet longHashSet = new LongOpenHashSet(longs);
    return longHashSet::contains;
}
Also used : LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet)

Example 8 with LongOpenHashSet

use of it.unimi.dsi.fastutil.longs.LongOpenHashSet in project druid by druid-io.

the class InDimFilter method createDoublePredicate.

private static DruidDoublePredicate createDoublePredicate(final Set<String> values) {
    LongArrayList doubleBits = new LongArrayList(values.size());
    for (String value : values) {
        Double doubleValue = DimensionHandlerUtils.convertObjectToDouble(value);
        if (doubleValue != null) {
            doubleBits.add(Double.doubleToLongBits((doubleValue)));
        }
    }
    final LongOpenHashSet doubleBitsHashSet = new LongOpenHashSet(doubleBits);
    return input -> doubleBitsHashSet.contains(Double.doubleToLongBits(input));
}
Also used : JsonProperty(com.fasterxml.jackson.annotation.JsonProperty) RangeSet(com.google.common.collect.RangeSet) Comparators(org.apache.druid.java.util.common.guava.Comparators) SortedSet(java.util.SortedSet) ExtractionFn(org.apache.druid.query.extraction.ExtractionFn) LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) DimensionHandlerUtils(org.apache.druid.segment.DimensionHandlerUtils) ImmutableBitmap(org.apache.druid.collections.bitmap.ImmutableBitmap) CacheKeyBuilder(org.apache.druid.query.cache.CacheKeyBuilder) ColumnProcessors(org.apache.druid.segment.ColumnProcessors) ColumnSelectorFactory(org.apache.druid.segment.ColumnSelectorFactory) Map(java.util.Map) IAE(org.apache.druid.java.util.common.IAE) ImmutableSet(com.google.common.collect.ImmutableSet) VectorValueMatcherColumnProcessorFactory(org.apache.druid.query.filter.vector.VectorValueMatcherColumnProcessorFactory) Collection(java.util.Collection) Range(com.google.common.collect.Range) StringUtils(org.apache.druid.java.util.common.StringUtils) Set(java.util.Set) Sets(com.google.common.collect.Sets) VectorColumnSelectorFactory(org.apache.druid.segment.vector.VectorColumnSelectorFactory) StandardCharsets(java.nio.charset.StandardCharsets) Objects(java.util.Objects) List(java.util.List) Predicate(com.google.common.base.Predicate) IntArrayList(it.unimi.dsi.fastutil.ints.IntArrayList) Joiner(com.google.common.base.Joiner) Iterables(com.google.common.collect.Iterables) Supplier(com.google.common.base.Supplier) Hashing(com.google.common.hash.Hashing) BitmapIndex(org.apache.druid.segment.column.BitmapIndex) TreeRangeSet(com.google.common.collect.TreeRangeSet) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) IntIterator(it.unimi.dsi.fastutil.ints.IntIterator) LookupExtractionFn(org.apache.druid.query.lookup.LookupExtractionFn) IntIterable(it.unimi.dsi.fastutil.ints.IntIterable) VectorValueMatcher(org.apache.druid.query.filter.vector.VectorValueMatcher) JsonIgnore(com.fasterxml.jackson.annotation.JsonIgnore) Suppliers(com.google.common.base.Suppliers) Hasher(com.google.common.hash.Hasher) Nullable(javax.annotation.Nullable) BitmapResultFactory(org.apache.druid.query.BitmapResultFactory) ColumnInspector(org.apache.druid.segment.ColumnInspector) IntIteratorUtils(org.apache.druid.segment.IntIteratorUtils) Iterator(java.util.Iterator) ColumnSelector(org.apache.druid.segment.ColumnSelector) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet) IntOpenHashSet(it.unimi.dsi.fastutil.ints.IntOpenHashSet) NullHandling(org.apache.druid.common.config.NullHandling) LookupExtractor(org.apache.druid.query.lookup.LookupExtractor) JsonCreator(com.fasterxml.jackson.annotation.JsonCreator) JsonInclude(com.fasterxml.jackson.annotation.JsonInclude) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Comparator(java.util.Comparator) Filters(org.apache.druid.segment.filter.Filters) LongArrayList(it.unimi.dsi.fastutil.longs.LongArrayList) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet)

Example 9 with LongOpenHashSet

use of it.unimi.dsi.fastutil.longs.LongOpenHashSet in project RecurrentComplex by Ivorforce.

the class MapGenStructureHook method generate.

@Override
public void generate(World worldIn, int x, int z, ChunkPrimer primer) {
    this.world = worldIn;
    WorldServer server = (WorldServer) worldIn;
    this.rand.setSeed(worldIn.getSeed());
    long j = this.rand.nextLong();
    long k = this.rand.nextLong();
    initializeStructureData(base, world);
    Long2ObjectMap<StructureStart> map = getStructureMap(base);
    LongSet before = new LongOpenHashSet(map.keySet());
    base.generate(worldIn, x, z, primer);
    Sets.newHashSet(Collections2.filter(map.keySet(), Predicates.not(Predicates.in(before)))).forEach(key -> {
        StructureStart start = map.get(key);
        if (start.isSizeableStructure()) {
            this.rand.setSeed((j * start.getChunkPosX()) ^ (k * start.getChunkPosZ()) ^ worldIn.getSeed());
            Pair<Structure<?>, VanillaDecorationGeneration> selected = RCBiomeDecorator.selectDecoration(server, rand, new BlockPos(start.getChunkPosX() * 16, 0, start.getChunkPosZ() * 16), getDecorationType(start));
            if (// > 1 we can't handle yet...
            selected != null) {
                // int minY = start.getComponents().get(0).getBoundingBox().minY;
                // We don't want this anymore.
                // Don't just remove it from the list lest it get added again
                // Instead remove all components so it doesn't generate anything
                start.getComponents().clear();
                setStructureStart(base, start.getChunkPosX(), start.getChunkPosZ(), start);
                // Gen ours
                // Do this AFTER clearing because of chained chunk gen
                // HACKY This is important because technically we're in the planning phase and not allowed to gen
                RCBiomeDecorator.generate(selected, server, new ChunkPos(start.getChunkPosX(), start.getChunkPosZ()), rand);
            }
        }
    });
}
Also used : VanillaDecorationGeneration(ivorius.reccomplex.world.gen.feature.structure.generic.generation.VanillaDecorationGeneration) LongSet(it.unimi.dsi.fastutil.longs.LongSet) WorldServer(net.minecraft.world.WorldServer) BlockPos(net.minecraft.util.math.BlockPos) ChunkPos(net.minecraft.util.math.ChunkPos) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet) MapGenStructure(net.minecraft.world.gen.structure.MapGenStructure) StructureStart(net.minecraft.world.gen.structure.StructureStart)

Example 10 with LongOpenHashSet

use of it.unimi.dsi.fastutil.longs.LongOpenHashSet in project geode by apache.

the class DiskInitFile method calcMissing.

private LongOpenHashSet calcMissing(LongOpenHashSet found, LongOpenHashSet expected) {
    LongOpenHashSet missing = new LongOpenHashSet(expected);
    missing.removeAll(found);
    return missing;
}
Also used : LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet)

Aggregations

LongOpenHashSet (it.unimi.dsi.fastutil.longs.LongOpenHashSet)13 LongSet (it.unimi.dsi.fastutil.longs.LongSet)5 LongArrayList (it.unimi.dsi.fastutil.longs.LongArrayList)3 SqlType (com.facebook.presto.spi.function.SqlType)2 Supplier (com.google.common.base.Supplier)2 File (java.io.File)2 Collection (java.util.Collection)2 Map (java.util.Map)2 BlockBuilder (com.facebook.presto.common.block.BlockBuilder)1 BlockBuilder (com.facebook.presto.spi.block.BlockBuilder)1 BlockBuilderStatus (com.facebook.presto.spi.block.BlockBuilderStatus)1 JsonCreator (com.fasterxml.jackson.annotation.JsonCreator)1 JsonIgnore (com.fasterxml.jackson.annotation.JsonIgnore)1 JsonInclude (com.fasterxml.jackson.annotation.JsonInclude)1 JsonProperty (com.fasterxml.jackson.annotation.JsonProperty)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Joiner (com.google.common.base.Joiner)1 Preconditions (com.google.common.base.Preconditions)1 Predicate (com.google.common.base.Predicate)1 Suppliers (com.google.common.base.Suppliers)1