yihua commented on code in PR #12866:
URL: https://github.com/apache/hudi/pull/12866#discussion_r1978116785
##########
hudi-hadoop-common/src/main/java/org/apache/hudi/io/hadoop/HoodieHFileUtils.java:
##########
@@ -153,4 +155,57 @@ public void readFully(long position, byte[] buffer, int
offset, int length) thro
read(position, buffer, offset, length);
}
}
+
+ /**
+ * Create the specified file on the filesystem. By default, this will:
+ * <ol>
+ * <li>apply the umask in the configuration (if it is enabled)</li>
+ * <li>use the fs configured buffer size (or 4096 if not set)</li>
+ * <li>use the default replication</li>
+ * <li>use the default block size</li>
+ * <li>not track progress</li>
+ * </ol>
+ * @param fs {@link FileSystem} on which to write the file
+ * @param path {@link Path} to the file to write
+ * @param perm intial permissions
+ * @param overwrite Whether or not the created file should be overwritten.
+ * @return output stream to the created file
+ * @throws IOException if the file cannot be created
+ */
+ public static FSDataOutputStream create(FileSystem fs, Path path,
FsPermission perm,
+ boolean overwrite) throws
IOException {
+ return fs.create(path, perm, overwrite, getDefaultBufferSize(fs),
+ getDefaultReplication(fs, path), getDefaultBlockSize(fs, path), null);
+ }
+
+ /**
+ * Returns the default buffer size to use during writes. The size of the
buffer should probably be
+ * a multiple of hardware page size (4096 on Intel x86), and it determines
how much data is
+ * buffered during read and write operations.
+ * @param fs filesystem object
+ * @return default buffer size to use during writes
+ */
+ public static int getDefaultBufferSize(final FileSystem fs) {
Review Comment:
Let's see if we can get rid of these util methods and configs and use our
own config if needed.
##########
hudi-hadoop-common/src/test/java/org/apache/hudi/io/hadoop/TestHoodieHBaseHFileReaderWriter.java:
##########
@@ -63,7 +63,8 @@
import static
org.apache.hudi.io.storage.TestHoodieReaderWriterUtils.writeHFileForTesting;
import static org.junit.jupiter.api.Assertions.assertEquals;
-public class TestHoodieHBaseHFileReaderWriter extends
TestHoodieHFileReaderWriterBase {
+@Disabled("HUDI-9084")
Review Comment:
Are the tests still broken or we can re-enable the tests now after your
recent fixes?
##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/HFileBlock.java:
##########
@@ -45,7 +45,7 @@ public abstract class HFileBlock {
HFILEBLOCK_HEADER_SIZE_NO_CHECKSUM + SIZEOF_BYTE + 2 * SIZEOF_INT32;
// Each checksum value is an integer that can be stored in 4 bytes.
- static final int CHECKSUM_SIZE = SIZEOF_INT32;
+ public static final int CHECKSUM_SIZE = SIZEOF_INT32;
Review Comment:
Could we keep this default visibility after you keep the writer logic in the
same set of classes?
##########
hudi-io/src/main/java/org/apache/hudi/io/hfile/writer/KeyValueEntry.java:
##########
@@ -0,0 +1,38 @@
+/*
+ * 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.hudi.io.hfile.writer;
+
+import java.nio.ByteBuffer;
+
+public class KeyValueEntry implements Comparable<KeyValueEntry> {
+ final byte[] key;
+ final byte[] value;
Review Comment:
Could we reuse `KeyValue` or add a new subclass?
--
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]