You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2022/05/12 08:08:51 UTC

[GitHub] [iceberg] findepi commented on a diff in pull request #4537: Add Indexes and Stats format reader and writer

findepi commented on code in PR #4537:
URL: https://github.com/apache/iceberg/pull/4537#discussion_r871075100


##########
core/src/main/java/org/apache/iceberg/stats/StatsFormat.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * 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.iceberg.stats;
+
+import io.airlift.compress.Compressor;
+import io.airlift.compress.zstd.ZstdCompressor;
+import io.airlift.compress.zstd.ZstdDecompressor;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+
+final class StatsFormat {
+  private StatsFormat() {
+  }
+
+  static final int CURRENT_FORMAT_VERSION = 1;
+
+  static final int MAGIC_AS_NUMBER_LE = new BigInteger(swap(getMagic())).intValueExact();
+
+  static final int SUPPORTED_FLAGS = 0b1;
+  static final int FLAG_COMPRESSED = 0b1;
+
+  static byte[] getMagic() {
+    return new byte[] {0x50, 0x46, 0x49, 0x53};

Review Comment:
   I don't see a benefit of declaring it as a constant field, and i do feel strongly about sharing mutable state that's not supposed to be changed.



-- 
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: issues-unsubscribe@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org