Github user srowen commented on a diff in the pull request:
https://github.com/apache/spark/pull/14762#discussion_r75811715
--- Diff:
common/unsafe/src/main/java/org/apache/spark/unsafe/UnsafeAlignedOffset.java ---
@@ -0,0 +1,50 @@
+/*
+ * Class to make changes to record length offsets uniform throughout
various areas of apache spark core and unsafe.
+ * This is needed on SPARC because using an 4 byte Int for record lengths
causes the entire record of 8 byte Items to become
+ * misaligned by 4 bytes. So, using a 8 byte long for record length keeps
things aligned.
+ */
+
+package org.apache.spark.unsafe;
+
+import org.apache.spark.unsafe.Platform;
+
+import java.util.Arrays;
+import java.util.List;
+
+public class UnsafeAlignedOffset {
+
+ public static int uaoSize;
+ static final List<String> MISALIGNED_ARCH = Arrays.asList("sparc",
"sparcv9");
+
+ static{
+ if (MISALIGNED_ARCH.contains(System.getProperty("os.arch"))) {
+ uaoSize = 8;
+ }
+ else{
+ uaoSize = 4;
+ }
+ }
+
+ public static long UAO_getSize(Object object, long offset) {
--- End diff --
Bad naming for Java -- use camelCase for methods
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]