xiangfu0 commented on code in PR #19285:
URL: https://github.com/apache/pinot/pull/19285#discussion_r3848872638


##########
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:
   Addressed in 7c5dfae64c. The CodecBufferUtils private constructor now sits 
directly below the class declaration; I also audited the other utility class in 
this runtime, and CodecPipelineValidator already follows that placement.



##########
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:
   Addressed in 7c5dfae64c. Removed the redundant unannotated-argument null 
checks in CodecContext and CodecPipelineExecutor; actual nullable lookup and 
internal lifecycle checks remain.



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