From d5b5ad54ddf0696d08cd4198816f8d6407f60982 Mon Sep 17 00:00:00 2001 From: Alex Merritt Date: Wed, 17 Jul 2019 11:02:01 -0400 Subject: [PATCH] =?UTF-8?q?Fix=20a=20bug=20that=20prevents=20events=20with?= =?UTF-8?q?=20targetEntityType=20and=20targetEntity=E2=80=A6=20(#522)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix a bug that prevents events with targetEntityType and targetEntityId set from being returned by find from PPythonEventStore * Fix formatting --- .../data/store/python/PPythonEventStore.scala | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/data/src/main/scala/org/apache/predictionio/data/store/python/PPythonEventStore.scala b/data/src/main/scala/org/apache/predictionio/data/store/python/PPythonEventStore.scala index 1d03634e12..be269a97db 100644 --- a/data/src/main/scala/org/apache/predictionio/data/store/python/PPythonEventStore.scala +++ b/data/src/main/scala/org/apache/predictionio/data/store/python/PPythonEventStore.scala @@ -82,8 +82,17 @@ object PPythonEventStore { Option(entityType), Option(entityId), Option(eventNames), - Option(Option(targetEntityType)), - Option(Option(targetEntityId)))(spark.sparkContext).map { e => + targetEntityType match { + case null => None + case "" => Option(None) + case _ => Option(Option(targetEntityType)) + }, + targetEntityId match { + case null => None + case "" => Option(None) + case _ => Option(Option(targetEntityId)) + } + )(spark.sparkContext).map { e => ( e.eventId, e.event,