You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by sh...@apache.org on 2017/09/08 00:02:36 UTC

[1/2] incubator-predictionio git commit: [PIO-117] Cannot delete event data on ESLEvents

Repository: incubator-predictionio
Updated Branches:
  refs/heads/develop 8dcd94815 -> 69c5e3b77


[PIO-117] Cannot delete event data on ESLEvents

Closes #428


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

Branch: refs/heads/develop
Commit: 6cf89c50252988bf3b2007c82d666b4205a98beb
Parents: 8dcd948
Author: Shinsuke Sugaya <sh...@apache.org>
Authored: Fri Sep 8 09:00:25 2017 +0900
Committer: Shinsuke Sugaya <sh...@apache.org>
Committed: Fri Sep 8 09:00:25 2017 +0900

----------------------------------------------------------------------
 .../data/storage/elasticsearch/ESLEvents.scala            | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/6cf89c50/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
----------------------------------------------------------------------
diff --git a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
index 5e1f4c1..185be92 100644
--- a/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
+++ b/storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESLEvents.scala
@@ -287,16 +287,10 @@ class ESLEvents(val client: RestClient, config: StorageClientConfig, val index:
           Map("refresh" -> ESUtils.getEventDataRefresh(config)).asJava,
           entity)
         val jsonResponse = parse(EntityUtils.toString(response.getEntity))
-        val result = (jsonResponse \ "result").extract[String]
-        result match {
-          case "deleted" => true
-          case _ =>
-            error(s"[$result] Failed to update $index/$estype:$eventId")
-            false
-        }
+        (jsonResponse \ "deleted").extract[Int] > 0
       } catch {
         case e: IOException =>
-          error(s"Failed to update $index/$estype:$eventId", e)
+          error(s"Failed to delete $index/$estype:$eventId", e)
           false
       }
     }


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

Posted by sh...@apache.org.
[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 <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
       }
     }