You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hivemall.apache.org by my...@apache.org on 2019/10/21 07:22:13 UTC

[incubator-hivemall] branch master updated: [HIVEMALL-244] Support Java9, Java11(LTS)

This is an automated email from the ASF dual-hosted git repository.

myui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hivemall.git


The following commit(s) were added to refs/heads/master by this push:
     new 0c7ba17  [HIVEMALL-244] Support Java9, Java11(LTS)
0c7ba17 is described below

commit 0c7ba1734006a69b3173758b7a7106a835b3c6c2
Author: Makoto Yui <my...@apache.org>
AuthorDate: Mon Oct 21 16:22:05 2019 +0900

    [HIVEMALL-244] Support Java9, Java11(LTS)
    
    ## What changes were proposed in this pull request?
    
    Support Java9, Java11(LTS)
    
    ## What type of PR is it?
    
    Improvement | Hot Fix
    
    ## What is the Jira issue?
    
    https://issues.apache.org/jira/browse/HIVEMALL-244
    
    ## How was this patch tested?
    
    unit tests
    
    ## Checklist
    
    (Please remove this section if not needed; check `x` for YES, blank for NO)
    
    - [x] Did you apply source code formatter, i.e., `./bin/format_code.sh`, for your commit?
    - [ ] Did you run system tests on Hive (or Spark)?
    
    Author: Makoto Yui <my...@apache.org>
    
    Closes #203 from myui/HIVEMALL-244.
---
 .travis.yml                                        | 22 ++++----
 bin/run_travis_tests.sh                            | 11 ----
 core/pom.xml                                       | 22 ++++----
 .../java/hivemall/fm/FactorizationMachineUDTF.java |  4 +-
 .../ProbabilisticTopicModelBaseUDTF.java           |  4 +-
 .../ftvec/trans/BinarizeLabelUDTFTest.java         | 60 ----------------------
 mixserv/pom.xml                                    | 12 +++++
 nlp/pom.xml                                        | 12 +++++
 pom.xml                                            | 17 ++++--
 xgboost/pom.xml                                    | 12 +++++
 10 files changed, 74 insertions(+), 102 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 8b2427e..ae97bcc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,3 +1,5 @@
+# Container-based infrastructure has been fully deprecated.
+# https://docs.travis-ci.com/user/reference/trusty/#container-based-infrastructure
 sudo: false
 
 env:
@@ -6,32 +8,26 @@ env:
    #   via the "travis encrypt" command using the project repo's public key
    - secure: "gYAzVukFw3ssmQzfovoKTNJnzQbUhF13tksHHhe5dqQWglxdix39wY405nMmzRm/21ZpIq3OFIlI7fnHdZSGkVPS/nPPxbzUkjYUh+zkujYwsqgjZecq9vGaoarnyV9CcI+2D6qUVnArHQ02FKxirtXduGvElZ/eRIa/hBfpgn4="
 
-#addons:
-#  coverity_scan:
-#    project:
-#      name: "myui/hivemall"
-#      description: "Build submitted via Travis CI"
-#    notification_email: false
-#    build_command_prepend: "mvn clean"
-#    build_command:   "mvn -DskipTests=true compile"
-#    branch_pattern: master
-
 dist: trusty
+
 language: java
 jdk:
 # - openjdk7
-# - oraclejdk7
   - oraclejdk8
-# - oraclejdk9
+  - oraclejdk9
+  - oraclejdk11
 
 branches:
   only:
     - master
-    - develop
 
 notifications:
   email: false
 
+cache:
+  directories:
+  - $HOME/.m2
+
 script:
   - ./bin/run_travis_tests.sh
 
diff --git a/bin/run_travis_tests.sh b/bin/run_travis_tests.sh
index 3f0b090..06c0f75 100755
--- a/bin/run_travis_tests.sh
+++ b/bin/run_travis_tests.sh
@@ -18,17 +18,6 @@
 # under the License.
 #
 
-if [ "$HIVEMALL_HOME" = "" ]; then
-  if [ -e ../bin/${0##*/} ]; then
-    HIVEMALL_HOME=".."
-  elif [ -e ./bin/${0##*/} ]; then
-    HIVEMALL_HOME="."
-  else
-    echo "env HIVEMALL_HOME not defined"
-    exit 1
-  fi
-fi
-
 set -ev
 
 mvn clean test
diff --git a/core/pom.xml b/core/pom.xml
index 645967d..59cd169 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -42,11 +42,23 @@
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-common</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-mapreduce-client-core</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hive</groupId>
@@ -153,16 +165,6 @@
 			<artifactId>mockito-core</artifactId>
 			<scope>test</scope>
 		</dependency>
-		<dependency>
-			<groupId>org.powermock</groupId>
-			<artifactId>powermock-module-junit4</artifactId>
-			<scope>test</scope>
-		</dependency>
-		<dependency>
-			<groupId>org.powermock</groupId>
-			<artifactId>powermock-api-mockito</artifactId>
-			<scope>test</scope>
-		</dependency>
 	</dependencies>
 
 </project>
diff --git a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
index 4a39101..1d8509c 100644
--- a/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
+++ b/core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java
@@ -124,8 +124,8 @@ public class FactorizationMachineUDTF extends UDTFWithOptions {
     protected long _numValidations;
 
     // file IO
-    private ByteBuffer _inputBuf;
-    private NioStatefulSegment _fileIO;
+    private transient ByteBuffer _inputBuf;
+    private transient NioStatefulSegment _fileIO;
 
     @Override
     protected Options getOptions() {
diff --git a/core/src/main/java/hivemall/topicmodel/ProbabilisticTopicModelBaseUDTF.java b/core/src/main/java/hivemall/topicmodel/ProbabilisticTopicModelBaseUDTF.java
index 5a5fbce..c13d18b 100644
--- a/core/src/main/java/hivemall/topicmodel/ProbabilisticTopicModelBaseUDTF.java
+++ b/core/src/main/java/hivemall/topicmodel/ProbabilisticTopicModelBaseUDTF.java
@@ -78,8 +78,8 @@ public abstract class ProbabilisticTopicModelBaseUDTF extends UDTFWithOptions {
     protected ListObjectInspector wordCountsOI;
 
     // for iterations
-    protected NioStatefulSegment fileIO;
-    protected ByteBuffer inputBuf;
+    protected transient NioStatefulSegment fileIO;
+    protected transient ByteBuffer inputBuf;
 
     private float cumPerplexity;
 
diff --git a/core/src/test/java/hivemall/ftvec/trans/BinarizeLabelUDTFTest.java b/core/src/test/java/hivemall/ftvec/trans/BinarizeLabelUDTFTest.java
index 55b4e53..3824bd0 100644
--- a/core/src/test/java/hivemall/ftvec/trans/BinarizeLabelUDTFTest.java
+++ b/core/src/test/java/hivemall/ftvec/trans/BinarizeLabelUDTFTest.java
@@ -18,13 +18,6 @@
  */
 package hivemall.ftvec.trans;
 
-import static org.mockito.AdditionalMatchers.aryEq;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.times;
-import static org.powermock.api.mockito.PowerMockito.doNothing;
-import static org.powermock.api.mockito.PowerMockito.spy;
-import static org.powermock.api.mockito.PowerMockito.verifyPrivate;
-
 import hivemall.TestUtils;
 import hivemall.utils.hadoop.WritableUtils;
 
@@ -36,12 +29,7 @@ import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspector;
 import org.apache.hadoop.hive.serde2.objectinspector.ObjectInspectorFactory;
 import org.apache.hadoop.hive.serde2.objectinspector.primitive.PrimitiveObjectInspectorFactory;
 import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
 
-@RunWith(PowerMockRunner.class)
-@PrepareForTest({BinarizeLabelUDTF.class})
 public class BinarizeLabelUDTFTest {
 
     // ignored to avoid
@@ -60,54 +48,6 @@ public class BinarizeLabelUDTFTest {
     }
 
     @Test
-    public void test2Positive3NegativeSample() throws Exception {
-        BinarizeLabelUDTF udtf = spy(new BinarizeLabelUDTF());
-        ObjectInspector[] argOIs = new ObjectInspector[3];
-        argOIs[0] = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
-        argOIs[1] = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
-        List<String> featureNames = Arrays.asList("positive", "negative", "features");
-        argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
-            PrimitiveObjectInspectorFactory.javaStringObjectInspector, featureNames);
-
-        doNothing().when(udtf, "forward", any());
-        udtf.initialize(argOIs);
-
-        Object[] arguments = new Object[3];
-        arguments[0] = new Integer(2);
-        arguments[1] = new Integer(3);
-        arguments[2] = WritableUtils.val("a:1", "b:2");
-        udtf.process(arguments);
-
-        verifyPrivate(udtf, times(5)).invoke("forward", any(Object[].class));
-        verifyPrivate(udtf, times(2)).invoke("forward",
-            aryEq(new Object[] {WritableUtils.val("a:1", "b:2"), 1}));
-        verifyPrivate(udtf, times(3)).invoke("forward",
-            aryEq(new Object[] {WritableUtils.val("a:1", "b:2"), 0}));
-    }
-
-    @Test
-    public void test0Positive0NegativeSample() throws Exception {
-        BinarizeLabelUDTF udtf = spy(new BinarizeLabelUDTF());
-        ObjectInspector[] argOIs = new ObjectInspector[3];
-        argOIs[0] = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
-        argOIs[1] = PrimitiveObjectInspectorFactory.javaIntObjectInspector;
-        List<String> featureNames = Arrays.asList("positive", "negative", "features");
-        argOIs[2] = ObjectInspectorFactory.getStandardConstantListObjectInspector(
-            PrimitiveObjectInspectorFactory.javaStringObjectInspector, featureNames);
-
-        doNothing().when(udtf, "forward", any());
-        udtf.initialize(argOIs);
-
-        Object[] arguments = new Object[3];
-        arguments[0] = new Integer(0);
-        arguments[1] = new Integer(0);
-        arguments[2] = WritableUtils.val("a:1", "b:2");
-        udtf.process(arguments);
-
-        verifyPrivate(udtf, times(0)).invoke("forward", any(Object[].class));
-    }
-
-    @Test
     public void testSerialization() throws HiveException {
         final List<String> featureNames = Arrays.asList("positive", "negative", "features");
         TestUtils.testGenericUDTFSerialization(BinarizeLabelUDTF.class,
diff --git a/mixserv/pom.xml b/mixserv/pom.xml
index fd863a5..d1c0f6b 100644
--- a/mixserv/pom.xml
+++ b/mixserv/pom.xml
@@ -40,11 +40,23 @@
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-common</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-mapreduce-client-core</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hive</groupId>
diff --git a/nlp/pom.xml b/nlp/pom.xml
index 0bce2ac..c1cfd05 100644
--- a/nlp/pom.xml
+++ b/nlp/pom.xml
@@ -40,11 +40,23 @@
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-common</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-mapreduce-client-core</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hive</groupId>
diff --git a/pom.xml b/pom.xml
index 157b7db..47e3154 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,9 @@
   specific language governing permissions and limitations
   under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 	<modelVersion>4.0.0</modelVersion>
 
 	<groupId>org.apache.hivemall</groupId>
@@ -24,9 +26,9 @@
 	<version>0.6.0-incubating-SNAPSHOT</version>
 
 	<parent>
-	  <groupId>org.apache</groupId>
-	  <artifactId>apache</artifactId>
-	  <version>21</version>
+		<groupId>org.apache</groupId>
+		<artifactId>apache</artifactId>
+		<version>21</version>
 	</parent>
 
 	<name>Apache Hivemall</name>
@@ -571,6 +573,7 @@
 						<docencoding>UTF-8</docencoding>
 						<show>protected</show>
 						<linksource>true</linksource>
+						<source>7</source>
 					</configuration>
 					<executions>
 						<execution>
@@ -650,6 +653,12 @@
 								<requireEnvironmentVariable>
 									<variableName>JAVA_HOME</variableName>
 								</requireEnvironmentVariable>
+								<bannedDependencies>
+									<excludes>
+										<!-- see STORM-3114 -->
+										<exclude>jdk.tools:jdk.tools:*</exclude>
+									</excludes>
+								</bannedDependencies>
 							</rules>
 							<fail>true</fail>
 						</configuration>
diff --git a/xgboost/pom.xml b/xgboost/pom.xml
index 7b7d1df..0c77a54 100644
--- a/xgboost/pom.xml
+++ b/xgboost/pom.xml
@@ -40,11 +40,23 @@
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-common</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hadoop</groupId>
 			<artifactId>hadoop-mapreduce-client-core</artifactId>
 			<scope>provided</scope>
+			<exclusions>
+				<exclusion>
+					<artifactId>jdk.tools</artifactId>
+					<groupId>jdk.tools</groupId>
+				</exclusion>
+			</exclusions>
 		</dependency>
 		<dependency>
 			<groupId>org.apache.hive</groupId>