clintropolis commented on a change in pull request #6016: Druid 'Shapeshifting' Columns URL: https://github.com/apache/incubator-druid/pull/6016#discussion_r207146469
########## File path: processing/src/main/java/io/druid/segment/data/codecs/ints/LemireIntFormDecoder.java ########## @@ -0,0 +1,147 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.druid.segment.data.codecs.ints; + +import io.druid.collections.NonBlockingPool; +import io.druid.collections.ResourceHolder; +import io.druid.segment.CompressedPools; +import io.druid.segment.data.ShapeShiftingColumn; +import io.druid.segment.data.ShapeShiftingColumnarInts; +import io.druid.segment.data.codecs.BaseFormDecoder; +import me.lemire.integercompression.IntWrapper; +import me.lemire.integercompression.SkippableIntegerCODEC; +import sun.misc.Unsafe; +import sun.nio.ch.DirectBuffer; + +import java.nio.ByteBuffer; +import java.nio.ByteOrder; + +/** + * Integer form decoder using {@link <a href="https://github.com/lemire/JavaFastPFOR">JavaFastPFOR</a>}. Any + * {@link SkippableIntegerCODEC} will work, but currently only {@link me.lemire.integercompression.FastPFOR} is + * setup as a known encoding in {@link IntCodecs} as {@link IntCodecs#FASTPFOR}. + * Eagerly decodes all values to {@link ShapeShiftingColumnarInts#decodedValues}. + * + * layout: + * | header (byte) | encoded values (numOutputInts * Integer.BYTES) | + */ +public final class LemireIntFormDecoder extends BaseFormDecoder<ShapeShiftingColumnarInts> Review comment: There are actually a [variety of different algorithms in the JavaFastPFOR library](https://github.com/lemire/JavaFastPFOR/tree/master/src/main/java/me/lemire/integercompression) and this encoder/decoder pair supports any that implement `SkippableIntegerCodec`. I've only added a top level [mapping for FastPFOR](https://github.com/apache/incubator-druid/pull/6016/files#diff-75946f2221ac831d3698fe1cd4f25cd1R338) because it's the only one I've tested extensively, but I was planning on benchmarking some of the additional algorithms available in the library at some point to determine if any are worth adding to the mix. That said, this was the original naming, and if the rest prove lame I can certainly make this change. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
