You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by do...@apache.org on 2017/03/06 06:42:47 UTC

incubator-predictionio git commit: Unit is not Unit value

Repository: incubator-predictionio
Updated Branches:
  refs/heads/develop cc5bb9165 -> 4e3d1993e


Unit is not Unit value

Closes #347


Project: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/commit/4e3d1993
Tree: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/tree/4e3d1993
Diff: http://git-wip-us.apache.org/repos/asf/incubator-predictionio/diff/4e3d1993

Branch: refs/heads/develop
Commit: 4e3d1993e5b8a401c88192f7ef0a23bd7063c0f2
Parents: cc5bb91
Author: Naoki Takezoe <ta...@gmail.com>
Authored: Sun Mar 5 22:42:17 2017 -0800
Committer: Donald Szeto <do...@apache.org>
Committed: Sun Mar 5 22:42:17 2017 -0800

----------------------------------------------------------------------
 .../main/scala/org/apache/predictionio/controller/Engine.scala | 4 ++--
 .../scala/org/apache/predictionio/controller/LAlgorithm.scala  | 2 +-
 .../org/apache/predictionio/controller/P2LAlgorithm.scala      | 2 +-
 .../scala/org/apache/predictionio/controller/PAlgorithm.scala  | 4 ++--
 .../scala/org/apache/predictionio/core/BaseAlgorithm.scala     | 2 +-
 .../scala/org/apache/predictionio/workflow/CreateServer.scala  | 2 +-
 .../scala/org/apache/predictionio/workflow/FakeWorkflow.scala  | 2 +-
 .../scala/org/apache/predictionio/controller/EngineTest.scala  | 6 +++---
 .../src/main/scala/org/apache/predictionio/tools/Runner.scala  | 4 ++--
 9 files changed, 14 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/controller/Engine.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/controller/Engine.scala b/core/src/main/scala/org/apache/predictionio/controller/Engine.scala
index 881273c..436c542 100644
--- a/core/src/main/scala/org/apache/predictionio/controller/Engine.scala
+++ b/core/src/main/scala/org/apache/predictionio/controller/Engine.scala
@@ -208,7 +208,7 @@ class Engine[TD, EI, PD, Q, P, A](
       Doer(algorithmClassMap(algoName), algoParams)
     }
 
-    val models = if (persistedModels.exists(m => m.isInstanceOf[Unit.type])) {
+    val models = if (persistedModels.exists(m => m.isInstanceOf[Unit])) {
       // If any of persistedModels is Unit, we need to re-train the model.
       logger.info("Some persisted models are Unit, need to re-train.")
       val (dataSourceName, dataSourceParams) = engineParams.dataSourceParams
@@ -222,7 +222,7 @@ class Engine[TD, EI, PD, Q, P, A](
 
       val models = algorithms.zip(persistedModels).map { case (algo, m) =>
         m match {
-          case Unit => algo.trainBase(sc, pd)
+          case () => algo.trainBase(sc, pd)
           case _ => m
         }
       }

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/controller/LAlgorithm.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/controller/LAlgorithm.scala b/core/src/main/scala/org/apache/predictionio/controller/LAlgorithm.scala
index 32b7d0c..9e973e4 100644
--- a/core/src/main/scala/org/apache/predictionio/controller/LAlgorithm.scala
+++ b/core/src/main/scala/org/apache/predictionio/controller/LAlgorithm.scala
@@ -124,7 +124,7 @@ abstract class LAlgorithm[PD, M : ClassTag, Q, P]
         modelId, algoParams, sc)) {
         PersistentModelManifest(className = m.getClass.getName)
       } else {
-        Unit
+        ()
       }
     } else {
       m

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/controller/P2LAlgorithm.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/controller/P2LAlgorithm.scala b/core/src/main/scala/org/apache/predictionio/controller/P2LAlgorithm.scala
index 3a9e61c..ede8dc2 100644
--- a/core/src/main/scala/org/apache/predictionio/controller/P2LAlgorithm.scala
+++ b/core/src/main/scala/org/apache/predictionio/controller/P2LAlgorithm.scala
@@ -115,7 +115,7 @@ abstract class P2LAlgorithm[PD, M: ClassTag, Q: ClassTag, P]
         modelId, algoParams, sc)) {
         PersistentModelManifest(className = m.getClass.getName)
       } else {
-        Unit
+        ()
       }
     } else {
       m

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala b/core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala
index 4a3e012..3419de3 100644
--- a/core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala
+++ b/core/src/main/scala/org/apache/predictionio/controller/PAlgorithm.scala
@@ -120,10 +120,10 @@ abstract class PAlgorithm[PD, M, Q, P]
         modelId, algoParams, sc)) {
         PersistentModelManifest(className = m.getClass.getName)
       } else {
-        Unit
+        ()
       }
     } else {
-      Unit
+      ()
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala b/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala
index 0c9faa7..8b9edc1 100644
--- a/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala
+++ b/core/src/main/scala/org/apache/predictionio/core/BaseAlgorithm.scala
@@ -112,7 +112,7 @@ abstract class BaseAlgorithm[PD, M, Q, P]
     sc: SparkContext,
     modelId: String,
     algoParams: Params,
-    bm: Any): Any = Unit
+    bm: Any): Any = ()
 
   /** :: DeveloperApi ::
     * Obtains the type signature of query for this algorithm

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala b/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala
index ddc8d90..6f274bc 100644
--- a/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala
+++ b/core/src/main/scala/org/apache/predictionio/workflow/CreateServer.scala
@@ -268,7 +268,7 @@ class MasterActor (
         .param(ServerKey.param, ServerKey.get)
         .method("POST").asString.code
       code match {
-        case 200 => Unit
+        case 200 => ()
         case 404 => log.error(
           s"Another process is using $serverUrl. Unable to undeploy.")
         case _ => log.error(

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/main/scala/org/apache/predictionio/workflow/FakeWorkflow.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/org/apache/predictionio/workflow/FakeWorkflow.scala b/core/src/main/scala/org/apache/predictionio/workflow/FakeWorkflow.scala
index 69a5f59..c9b1d23 100644
--- a/core/src/main/scala/org/apache/predictionio/workflow/FakeWorkflow.scala
+++ b/core/src/main/scala/org/apache/predictionio/workflow/FakeWorkflow.scala
@@ -102,7 +102,7 @@ trait FakeRun extends Evaluation with EngineParamsGenerator {
     engineParamsList = Seq(new EngineParams())
   }
 
-  def func: (SparkContext => Unit) = { (sc: SparkContext) => Unit }
+  def func: (SparkContext => Unit) = { (sc: SparkContext) => () }
   def func_=(f: SparkContext => Unit) {
     runner = new FakeRunner(f)
   }

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/core/src/test/scala/org/apache/predictionio/controller/EngineTest.scala
----------------------------------------------------------------------
diff --git a/core/src/test/scala/org/apache/predictionio/controller/EngineTest.scala b/core/src/test/scala/org/apache/predictionio/controller/EngineTest.scala
index 65a363c..94879a5 100644
--- a/core/src/test/scala/org/apache/predictionio/controller/EngineTest.scala
+++ b/core/src/test/scala/org/apache/predictionio/controller/EngineTest.scala
@@ -60,7 +60,7 @@ extends FunSuite with Inside with SharedSparkContext {
 
     // PAlgo2.Model doesn't have IPersistentModel trait implemented. Hence the
     // model extract after train is Unit.
-    models should contain theSameElementsAs Seq(Unit)
+    models should contain theSameElementsAs Seq(())
   }
 
   test("Engine.train persisting PAlgo.Model") {
@@ -96,7 +96,7 @@ extends FunSuite with Inside with SharedSparkContext {
     val pModel21 = PersistentModelManifest(model21.getClass.getName)
     val pModel22 = PersistentModelManifest(model22.getClass.getName)
     
-    models should contain theSameElementsAs Seq(Unit, pModel21, pModel22)
+    models should contain theSameElementsAs Seq((), pModel21, pModel22)
   }
 
   test("Engine.train persisting LAlgo.Model") {
@@ -181,7 +181,7 @@ extends FunSuite with Inside with SharedSparkContext {
     val pModel23 = PersistentModelManifest(model23.getClass.getName)
     
     models should contain theSameElementsAs Seq(
-      Unit, pModel21, pModel22, pModel23, model24, model25)
+      (), pModel21, pModel22, pModel23, model24, model25)
   }
 
   test("Engine.eval") {

http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/4e3d1993/tools/src/main/scala/org/apache/predictionio/tools/Runner.scala
----------------------------------------------------------------------
diff --git a/tools/src/main/scala/org/apache/predictionio/tools/Runner.scala b/tools/src/main/scala/org/apache/predictionio/tools/Runner.scala
index f98dda1..4f5a176 100644
--- a/tools/src/main/scala/org/apache/predictionio/tools/Runner.scala
+++ b/tools/src/main/scala/org/apache/predictionio/tools/Runner.scala
@@ -73,7 +73,7 @@ object Runner extends EitherLogging {
     (fs, uri) match {
       case (Some(f), Some(u)) =>
         f.close()
-      case _ => Unit
+      case _ => ()
     }
   }
 
@@ -114,7 +114,7 @@ object Runner extends EitherLogging {
       case (_, "cluster", m) if m.startsWith("spark://") =>
         return logAndFail(
           "Using cluster deploy mode with Spark standalone cluster is not supported")
-      case _ => Unit
+      case _ => ()
     }
 
     // Initialize HDFS API for scratch URI