You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by ch...@apache.org on 2017/09/27 22:11:12 UTC

[37/50] [abbrv] incubator-predictionio git commit: [PIO-118] ClassCastException from NullWritable to Text in ESEventsUtil

[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/master
Commit: 69c5e3b777500b0ecc23516d4ae11c2fc95505c8
Parents: 6cf89c5
Author: Shinsuke Sugaya <sh...@apache.org>
Authored: Fri Sep 8 09:02:15 2017 +0900
Committer: Shinsuke Sugaya <sh...@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
       }
     }