Applied refactoring to the previous commit

Project: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-hivemall/commit/1dac1a62
Tree: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/tree/1dac1a62
Diff: http://git-wip-us.apache.org/repos/asf/incubator-hivemall/diff/1dac1a62

Branch: refs/heads/master
Commit: 1dac1a62fbf35848deca8f0a8aa96f01dc1c0f2d
Parents: 78acc42
Author: myui <[email protected]>
Authored: Tue Jun 6 15:24:38 2017 +0900
Committer: myui <[email protected]>
Committed: Tue Jun 6 15:32:19 2017 +0900

----------------------------------------------------------------------
 .../main/java/hivemall/fm/FactorizationMachineUDTF.java | 12 ++++++------
 core/src/main/java/hivemall/topicmodel/LDAUDTF.java     |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/1dac1a62/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java 
b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
index d263cbc..3fadc38 100644
--- a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
+++ b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
@@ -30,6 +30,7 @@ import hivemall.utils.hadoop.HiveUtils;
 import hivemall.utils.io.FileUtils;
 import hivemall.utils.io.NioStatefullSegment;
 import hivemall.utils.lang.NumberUtils;
+import hivemall.utils.lang.SizeOf;
 import hivemall.utils.math.MathUtils;
 
 import java.io.File;
@@ -67,7 +68,6 @@ import org.apache.hadoop.mapred.Reporter;
         value = "_FUNC_(array<string> x, double y [, const string options]) - 
Returns a prediction model")
 public class FactorizationMachineUDTF extends UDTFWithOptions {
     private static final Log LOG = 
LogFactory.getLog(FactorizationMachineUDTF.class);
-    private static final int INT_BYTES = Integer.SIZE / 8;
 
     protected ListObjectInspector _xOI;
     protected PrimitiveObjectInspector _yOI;
@@ -318,8 +318,8 @@ public class FactorizationMachineUDTF extends 
UDTFWithOptions {
         }
 
         int xBytes = Feature.requiredBytes(x);
-        int recordBytes = (Integer.SIZE + Double.SIZE) / 8 + xBytes;
-        int requiredBytes = (Integer.SIZE / 8) + recordBytes;
+        int recordBytes = SizeOf.INT + SizeOf.DOUBLE + xBytes;
+        int requiredBytes = SizeOf.INT + recordBytes;
         int remain = inputBuf.remaining();
         if (remain < requiredBytes) {
             writeBuffer(inputBuf, dst);
@@ -612,13 +612,13 @@ public class FactorizationMachineUDTF extends 
UDTFWithOptions {
                         // reads training examples from a buffer
                         inputBuf.flip();
                         int remain = inputBuf.remaining();
-                        if (remain < INT_BYTES) {
+                        if (remain < SizeOf.INT) {
                             throw new HiveException("Illegal file format was 
detected");
                         }
-                        while (remain >= INT_BYTES) {
+                        while (remain >= SizeOf.INT) {
                             int pos = inputBuf.position();
                             int recordBytes = inputBuf.getInt();
-                            remain -= INT_BYTES;
+                            remain -= SizeOf.INT;
                             if (remain < recordBytes) {
                                 inputBuf.position(pos);
                                 break;

http://git-wip-us.apache.org/repos/asf/incubator-hivemall/blob/1dac1a62/core/src/main/java/hivemall/topicmodel/LDAUDTF.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/hivemall/topicmodel/LDAUDTF.java 
b/core/src/main/java/hivemall/topicmodel/LDAUDTF.java
index daec7ea..de57518 100644
--- a/core/src/main/java/hivemall/topicmodel/LDAUDTF.java
+++ b/core/src/main/java/hivemall/topicmodel/LDAUDTF.java
@@ -546,7 +546,7 @@ public class LDAUDTF extends UDTFWithOptions {
      */
 
     @VisibleForTesting
-    public void closeWithoutModelReset() throws HiveException {
+    void closeWithoutModelReset() throws HiveException {
         // launch close(), but not forward & clear model
         if (count == 0) {
             this.model = null;

Reply via email to