[ https://issues.apache.org/jira/browse/PIO-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16141269#comment-16141269 ]
ASF GitHub Bot commented on PIO-110: ------------------------------------ Github user shimamoto commented on a diff in the pull request: https://github.com/apache/incubator-predictionio/pull/425#discussion_r135187633 --- Diff: storage/hbase/src/main/scala/org/apache/predictionio/data/storage/hbase/HBEventsUtil.scala --- @@ -376,32 +375,30 @@ object HBEventsUtil { } targetEntityType.foreach { tetOpt => - if (tetOpt.isEmpty) { - val filter = createSkipRowIfColumnExistFilter("targetEntityType") - filters.addFilter(filter) - } else { - tetOpt.foreach { tet => + tetOpt match { + case None => + val filter = createSkipRowIfColumnExistFilter("targetEntityType") + filters.addFilter(filter) + case Some(tet) => val filter = createBinaryFilter( "targetEntityType", Bytes.toBytes(tet)) // the entire row will be skipped if the column is not found. filter.setFilterIfMissing(true) filters.addFilter(filter) - } } } targetEntityId.foreach { teidOpt => - if (teidOpt.isEmpty) { - val filter = createSkipRowIfColumnExistFilter("targetEntityId") - filters.addFilter(filter) - } else { - teidOpt.foreach { teid => + teidOpt match { + case None => + val filter = createSkipRowIfColumnExistFilter("targetEntityId") + filters.addFilter(filter) + case Some(teid) => --- End diff -- Same above. > Refactor common code shared by CreateServer and BatchPredict > ------------------------------------------------------------ > > Key: PIO-110 > URL: https://issues.apache.org/jira/browse/PIO-110 > Project: PredictionIO > Issue Type: Improvement > Components: Core > Affects Versions: 0.12.0-incubating > Reporter: Donald Szeto > Assignee: Naoki Takezoe > Labels: newbie > > {{BatchPredict}} was created in PIO-105 and has a substantial amount of > shared code with {{CreateServer}}. It would be beneficial to refactor both of > them to share as much common code as possible. -- This message was sent by Atlassian JIRA (v6.4.14#64029)