lakshmanan-v commented on a change in pull request #7226: URL: https://github.com/apache/pinot/pull/7226#discussion_r695138429
########## File path: pinot-core/src/test/java/org/apache/pinot/queries/SerializedBytesQueriesTest.java ########## @@ -94,7 +94,7 @@ // Use non-default compression private static final double PERCENTILE_TDIGEST_COMPRESSION = 200; // Allow 5% quantile error due to the randomness of TDigest merge - private static final double PERCENTILE_TDIGEST_DELTA = 0.05 * Integer.MAX_VALUE; + public static final double PERCENTILE_TDIGEST_DELTA = 0.05 * Integer.MAX_VALUE; Review comment: Updated. ########## File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/customobject/SerializedQuantileDigest.java ########## @@ -0,0 +1,49 @@ +/** + * 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 org.apache.pinot.segment.local.customobject; + +import org.apache.pinot.segment.local.utils.CustomSerDeUtils; +import org.apache.pinot.spi.utils.BytesUtils; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * Serialized and comparable version of QuantileDigest. Compares QuantileDigest for a specific percentile value. + */ +public class SerializedQuantileDigest implements Comparable<SerializedQuantileDigest> { + private final double _percentile; + private final QuantileDigest _quantileDigest; + + public SerializedQuantileDigest(QuantileDigest quantileDigest, double percentile) { + _quantileDigest = quantileDigest; + _percentile = percentile; + } + + @Override + public int compareTo(SerializedQuantileDigest other) { + checkArgument(other._percentile == _percentile, "Percentile number doesn't match!"); + return Double.compare(_quantileDigest.getQuantile(_percentile / 100.0), + other._quantileDigest.getQuantile(_percentile / 100.0)); + } + + @Override + public String toString() { + return BytesUtils.toHexString(CustomSerDeUtils.QUANTILE_DIGEST_SER_DE.serialize(_quantileDigest)); + } +} Review comment: Fixed. ########## File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/customobject/SerializedQuantileDigest.java ########## @@ -0,0 +1,49 @@ +/** + * 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 org.apache.pinot.segment.local.customobject; + +import org.apache.pinot.segment.local.utils.CustomSerDeUtils; +import org.apache.pinot.spi.utils.BytesUtils; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * Serialized and comparable version of QuantileDigest. Compares QuantileDigest for a specific percentile value. + */ +public class SerializedQuantileDigest implements Comparable<SerializedQuantileDigest> { + private final double _percentile; + private final QuantileDigest _quantileDigest; + + public SerializedQuantileDigest(QuantileDigest quantileDigest, double percentile) { + _quantileDigest = quantileDigest; + _percentile = percentile; Review comment: Done. ########## File path: pinot-segment-local/src/main/java/org/apache/pinot/segment/local/customobject/SerializedTDigest.java ########## @@ -0,0 +1,49 @@ +/** + * 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 org.apache.pinot.segment.local.customobject; + +import com.tdunning.math.stats.TDigest; +import org.apache.pinot.segment.local.utils.CustomSerDeUtils; +import org.apache.pinot.spi.utils.BytesUtils; + +import static com.google.common.base.Preconditions.checkArgument; + +/** + * Serialized and comparable version of TDigest. Compares TDigest for a specific percentile value. + */ +public class SerializedTDigest implements Comparable<SerializedTDigest> { + private final double _percentile; + private final TDigest _tDigest; + + public SerializedTDigest(TDigest tDigest, double percentile) { + _tDigest = tDigest; + _percentile = percentile; Review comment: Done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org For additional commands, e-mail: commits-h...@pinot.apache.org