predictionio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shins...@apache.org
Subject [2/2] incubator-predictionio git commit: [PIO-118] ClassCastException from NullWritable to Text in ESEventsUtil
Date Fri, 08 Sep 2017 00:02:37 GMT
[PIO-118] ClassCastException from NullWritable to Text in ESEventsUtil

Closes #429


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

Branch: refs/heads/develop
Commit: 69c5e3b777500b0ecc23516d4ae11c2fc95505c8
Parents: 6cf89c5
Author: Shinsuke Sugaya <shinsuke@apache.org>
Authored: Fri Sep 8 09:02:15 2017 +0900
Committer: Shinsuke Sugaya <shinsuke@apache.org>
Committed: Fri Sep 8 09:02:15 2017 +0900

----------------------------------------------------------------------
 .../data/storage/elasticsearch/ESEventsUtil.scala            | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/69c5e3b7/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala
----------------------------------------------------------------------
diff --git a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala
b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala
index 749ab49..38dec8a 100644
--- a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala
+++ b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESEventsUtil.scala
@@ -51,11 +51,9 @@ object ESEventsUtil {
     }
 
     def getOptStringCol(col: String): Option[String] = {
-      val r = result.get(new Text(col))
-      if (r == null) {
-        None
-      } else {
-        Some(r.asInstanceOf[Text].toString())
+      result.get(new Text(col)) match {
+        case x if x.isInstanceOf[Text] => Some(x.asInstanceOf[Text].toString)
+        case _ => None
       }
     }
 


Mime
View raw message