nastra commented on code in PR #7988:
URL: https://github.com/apache/iceberg/pull/7988#discussion_r1261073846
##########
hive3/src/main/java/org/apache/iceberg/mr/hive/vector/CompatibilityHiveVectorUtils.java:
##########
@@ -67,10 +66,11 @@ public static MapWork findMapWork(JobConf job) {
LOG.debug("Initializing for input {}", inputName);
}
String prefixes = job.get(DagUtils.TEZ_MERGE_WORK_FILE_PREFIXES);
- if (prefixes != null && !StringUtils.isBlank(prefixes)) {
- // Currently SMB is broken, so we cannot check if it's compatible with
IO elevator.
- // So, we don't use the below code that would get the correct MapWork.
See HIVE-16985.
- return null;
+ if (prefixes != null && !prefixes.trim().isEmpty()) {
+ // Currently SMB is broken, so we cannot check if it's compatible
with IO elevator.
+ // So, we don't use the below code that would get the correct MapWork.
See HIVE-16985.
+ return null;
+ }
Review Comment:
I think } is an extra one and needs to be removed?
##########
aws/src/test/java/org/apache/iceberg/aws/s3/S3CommonUtils.java:
##########
@@ -0,0 +1,199 @@
+/*
+ * 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.aws.s3;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.io.Serializable;
+import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
+
+public class S3CommonUtils {
+
+ private S3CommonUtils() {}
+ /**
+ * Deserializes a single {@link Object} from an array of bytes.
+ *
+ * <p>If the call site incorrectly types the return value, a {@link
ClassCastException} is thrown
+ * from the call site. Without Generics in this declaration, the call site
must type cast and can
+ * cause the same ClassCastException. Note that in both cases, the
ClassCastException is in the
+ * call site, not in this method.
+ *
+ * <p>This code is borrowed from `org.apache.commons:commons-lang3`
+ *
+ * @param <T> the object type to be deserialized
+ * @param objectData the serialized object, must not be null
+ * @return the deserialized object
+ * @throws NullPointerException if {@code objectData} is {@code null}
+ * @throws IOException (runtime) if the serialization fails
+ */
+ public static <T> T deserialize(final byte[] objectData)
+ throws IOException, ClassNotFoundException {
+ Preconditions.checkNotNull(objectData, "objectData");
+ return deserialize(new ByteArrayInputStream(objectData));
+ }
+
+ /**
+ * Deserializes an {@link Object} from the specified stream.
+ *
+ * <p>The stream will be closed once the object is written. This avoids the
need for a finally
+ * clause, and maybe also exception handling, in the application code.
+ *
+ * <p>The stream passed in is not buffered internally within this method.
This is the
+ * responsibility of your application if desired.
+ *
+ * <p>If the call site incorrectly types the return value, a {@link
ClassCastException} is thrown
+ * from the call site. Without Generics in this declaration, the call site
must type cast and can
+ * cause the same ClassCastException. Note that in both cases, the
ClassCastException is in the
+ * call site, not in this method.
+ *
+ * <p>This code is borrowed from `org.apache.commons:commons-lang3`
+ *
+ * @param <T> the object type to be deserialized
+ * @param inputStream the serialized object input stream, must not be null
+ * @return the deserialized object
+ * @throws NullPointerException if {@code inputStream} is {@code null}
+ * @throws IOException (runtime) if the serialization fails
+ * @throws ClassNotFoundException if Class is not found
+ */
+ public static <T> T deserialize(final InputStream inputStream)
+ throws IOException, ClassNotFoundException {
+ Preconditions.checkNotNull(inputStream, "inputStream");
+ try (ObjectInputStream in = new ObjectInputStream(inputStream)) {
+ @SuppressWarnings("unchecked")
+ final T obj = (T) in.readObject();
+ return obj;
+ }
+ }
+ /**
Review Comment:
nit: newline missing
--
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]