szlta commented on a change in pull request #2750:
URL: https://github.com/apache/hive/pull/2750#discussion_r742974204



##########
File path: 
iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergSplit.java
##########
@@ -68,6 +73,23 @@ public Path getPath() {
     return new Path(tableLocation);
   }
 
+  @Override
+  public byte[] getBytesForHash() {
+    Collection<FileScanTask> fileScanTasks = innerSplit.task().files();
+
+    try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
+      for (FileScanTask task : fileScanTasks) {
+        baos.write(task.file().path().toString().getBytes());
+        byte[] startBytes = new byte[Long.BYTES];
+        SerDeUtils.writeLong(startBytes, 0, task.start());
+        baos.write(startBytes);
+      }
+      return baos.toByteArray();
+    } catch (IOException ioe) {
+      throw new RuntimeException("Couldn't produce hash input bytes for 
HiveIcebergSplit: " + this, ioe);

Review comment:
       Hmm I don't think we want to prepare for such cases. If the hash input 
calculation fails here then we probably have some corrupted split that 
shouldn't exist anyway.




-- 
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: gitbox-unsubscr...@hive.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscr...@hive.apache.org
For additional commands, e-mail: gitbox-h...@hive.apache.org

Reply via email to