srinipunuru commented on a change in pull request #1153: SAMZA-2320: Samza-sql: 
Refactor validation to cover more cases and make it more extensible.
URL: https://github.com/apache/samza/pull/1153#discussion_r324781741
 
 

 ##########
 File path: 
samza-sql/src/main/java/org/apache/samza/sql/translator/FilterTranslator.java
 ##########
 @@ -95,17 +96,23 @@ public void init(Context context) {
     public boolean apply(SamzaSqlRelMessage message) {
       long startProcessing = System.nanoTime();
       Object[] result = new Object[1];
-      expr.execute(translatorContext.getExecutionContext(), context, 
translatorContext.getDataContext(),
-          message.getSamzaSqlRelRecord().getFieldValues().toArray(), result);
-      if (result.length > 0 && result[0] instanceof Boolean) {
+      try {
+        expr.execute(translatorContext.getExecutionContext(), context, 
translatorContext.getDataContext(),
+            message.getSamzaSqlRelRecord().getFieldValues().toArray(), result);
+      } catch (Exception e) {
+        String errMsg = String.format("Handling the following rel message ran 
into an error. %s", message);
+        LOG.error(errMsg, e);
+        throw new SamzaException(errMsg, e);
+      }
+      if (result[0] instanceof Boolean) {
         boolean retVal = (Boolean) result[0];
-        log.debug(
+        LOG.debug(
             String.format("return value for input %s is %s",
                 
Arrays.asList(message.getSamzaSqlRelRecord().getFieldValues()).toString(), 
retVal));
         updateMetrics(startProcessing, retVal, System.nanoTime());
         return retVal;
       } else {
-        log.error("return value is not boolean");
+        LOG.error("return value is not boolean for rel message: %s", message);
 
 Review comment:
   Does this Log.error  use %s to do the format? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to