xiangfu0 commented on code in PR #18092:
URL: https://github.com/apache/pinot/pull/18092#discussion_r3036488543
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/forward/ForwardIndexType.java:
##########
@@ -113,6 +113,8 @@ private void validateForwardIndexEnabled(ForwardIndexConfig
forwardIndexConfig,
if (dictionaryConfig.isEnabled()) {
Preconditions.checkState(compressionCodec == null ||
compressionCodec.isApplicableToDictEncodedIndex(),
"Compression codec: %s is not applicable to dictionary encoded
column: %s", compressionCodec, column);
+ Preconditions.checkState(forwardIndexConfig.getTransformCodec() == null,
+ "Transform codec is not supported for dictionary-encoded column:
%s", column);
Review Comment:
This is no longer applicable — `TransformCodec` was removed. The codec
pipeline is now a `ChunkCodecPipeline` (list of `ChunkCodec` stages), and
dictionary-encoded columns never have a pipeline set.
##########
pinot-segment-spi/src/main/java/org/apache/pinot/segment/spi/compression/TransformCodec.java:
##########
@@ -0,0 +1,67 @@
+/**
+ * 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.spi.compression;
+
+/**
+ * Enum representing reversible numeric transforms that can be applied to
chunk data before compression.
+ * Unlike {@link ChunkCompressionType}, which defines byte-level compression
algorithms, TransformCodec
+ * operates on typed numeric values (INT/LONG) to reduce entropy before the
compression stage.
+ *
+ * <p>The transform is applied per-chunk: each chunk is independently
transformed and compressed.
+ * On read, the reverse transform is applied after decompression.</p>
+ *
+ * <p>Supported in V1 for single-value INT and LONG RAW forward index columns
only.</p>
+ */
+public enum TransformCodec {
+
+ /** No transform applied. */
+ NONE(0),
+
+ /**
+ * Delta encoding: stores the first value as-is, then each subsequent value
as the difference
+ * from the previous value. Effective for monotonically increasing data
(e.g., timestamps).
+ */
+ DELTA(1),
+
+ /**
+ * Double-delta encoding: stores the first value as-is, the first delta
as-is, then each
+ * subsequent value as the difference of consecutive deltas. Effective for
data with constant
+ * or near-constant step sizes (e.g., fixed-interval timestamps).
+ */
+ DOUBLE_DELTA(2);
+
+ private static final TransformCodec[] VALUES = values();
+
+ private final int _value;
+
+ TransformCodec(int value) {
+ _value = value;
+ }
+
+ public int getValue() {
+ return _value;
+ }
+
+ public static TransformCodec valueOf(int ordinal) {
+ if (ordinal < 0 || ordinal >= VALUES.length) {
+ throw new IllegalArgumentException("Invalid TransformCodec ordinal: " +
ordinal);
+ }
+ return VALUES[ordinal];
+ }
Review Comment:
No longer applicable — `TransformCodec` was removed entirely. The new
`ChunkCodec` enum uses an explicit `fromValue(int)` method that iterates over
all enum values and matches by `_value`, so it's safe against reordering.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]