Jackie-Jiang commented on code in PR #19285:
URL: https://github.com/apache/pinot/pull/19285#discussion_r3848064195


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/io/codec/CodecContext.java:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.io.codec;
+
+import java.util.Objects;
+import org.apache.pinot.spi.data.FieldSpec.DataType;
+
+
+/// Context supplied to [CodecDefinition#validateContext()] during pipeline 
validation.
+///
+/// Carries the column's stored data type so that codecs can reject 
unsupported types at
+/// configuration time rather than at runtime. Instances are immutable and 
thread-safe.
+final class CodecContext {
+  private final DataType _dataType;
+
+  CodecContext(DataType dataType) {
+    _dataType = Objects.requireNonNull(dataType, "dataType");

Review Comment:
   (minor) We don't usually do this check. Unannotated argument is treated as 
non-null. Same for other places



##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/io/codec/CodecBufferUtils.java:
##########
@@ -0,0 +1,82 @@
+/**
+ * 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.io.codec;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import org.apache.pinot.segment.spi.memory.CleanerUtil;
+
+
+/// Package-private buffer helpers shared across codec handler implementations.
+final class CodecBufferUtils {
+
+  /// Sanity cap (1 GiB) on any decompressed size declared by untrusted 
encoded segment data. A
+  /// corrupt or hostile declaration must never drive a giant pre-allocation; 
1 GiB is well above
+  /// any realistic chunk size.
+  static final long MAX_DECLARED_DECOMPRESSED_SIZE = 1L << 30;
+
+  private CodecBufferUtils() {

Review Comment:
   (minor) Put this next to the class definition, same for other util classes



-- 
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]

Reply via email to