Github user takezoe commented on a diff in the pull request:

    
https://github.com/apache/incubator-predictionio/pull/421#discussion_r134419379
  
    --- Diff: 
storage/elasticsearch/src/main/scala/org/apache/predictionio/data/storage/elasticsearch/ESPEvents.scala
 ---
    @@ -107,37 +107,32 @@ class ESPEvents(client: ESClient, config: 
StorageClientConfig, index: String)
         eventIds: RDD[String],
         appId: Int, channelId: Option[Int])(sc: SparkContext): Unit = {
         val estype = getEsType(appId, channelId)
    -    val restClient = client.open()
    -    try {
    -      eventIds.foreachPartition { iter =>
    -        iter.foreach { eventId =>
    -          try {
    -            val json =
    -              ("query" ->
    -                ("term" ->
    -                  ("eventId" -> eventId)))
    -            val entity = new NStringEntity(compact(render(json)), 
ContentType.APPLICATION_JSON)
    -            val response = restClient.performRequest(
    -              "POST",
    -              s"/$index/$estype/_delete_by_query",
    -              Map("refresh" -> ESUtils.getEventDataRefresh(config)).asJava)
    -            val jsonResponse = 
parse(EntityUtils.toString(response.getEntity))
    -            val result = (jsonResponse \ "result").extract[String]
    -            result match {
    -              case "deleted" => true
    -              case _ =>
    -                logger.error(s"[$result] Failed to update 
$index/$estype:$eventId")
    -                false
    -            }
    -          } catch {
    -            case e: IOException =>
    -              logger.error(s"Failed to update $index/$estype:$eventId", e)
    +    eventIds.foreachPartition { iter =>
    +      iter.foreach { eventId =>
    +        try {
    +          val json =
    +            ("query" ->
    +              ("term" ->
    +                ("eventId" -> eventId)))
    +          val entity = new NStringEntity(compact(render(json)), 
ContentType.APPLICATION_JSON)
    +          val response = client.performRequest(
    +            "POST",
    +            s"/$index/$estype/_delete_by_query",
    +            Map("refresh" -> ESUtils.getEventDataRefresh(config)).asJava)
    +          val jsonResponse = 
parse(EntityUtils.toString(response.getEntity))
    +          val result = (jsonResponse \ "result").extract[String]
    +          result match {
    +            case "deleted" => true
    --- End diff --
    
    `true` at here is no effect because the return type us `Unit`. I know it 
came from original code, but we should remove it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to