[ 
https://issues.apache.org/jira/browse/GRIFFIN-232?focusedWorklogId=208782&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-208782
 ]

ASF GitHub Bot logged work on GRIFFIN-232:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 06/Mar/19 13:05
            Start Date: 06/Mar/19 13:05
    Worklog Time Spent: 10m 
      Work Description: aborgatin commented on pull request #484: GRIFFIN-232 - 
add support pluggable predicates
URL: https://github.com/apache/griffin/pull/484#discussion_r262931370
 
 

 ##########
 File path: service/src/main/java/org/apache/griffin/core/util/MeasureUtil.java
 ##########
 @@ -54,6 +55,27 @@ private static void validateGriffinMeasure(GriffinMeasure 
measure) {
             throw new GriffinException.BadRequestException
                     (INVALID_CONNECTOR_NAME);
         }
+        if (!validatePredicates(measure)) {
+            throw new 
GriffinException.BadRequestException(INVALID_MEASURE_PREDICATE);
+        }
+    }
+
+    private static boolean validatePredicates(GriffinMeasure measure) {
+        for (DataSource dataSource : measure.getDataSources()) {
+            for (DataConnector dataConnector: dataSource.getConnectors()) {
+                for (SegmentPredicate segmentPredicate : 
dataConnector.getPredicates()) {
+                    try {
+                        Predicator predicator = 
PredicatorFactory.newPredicateInstance(segmentPredicate);
+                        if (predicator == null) {
 
 Review comment:
   fixed
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 208782)
    Time Spent: 0.5h  (was: 20m)

> Implement pluggable Predicators in PredicatorFactory
> ----------------------------------------------------
>
>                 Key: GRIFFIN-232
>                 URL: https://issues.apache.org/jira/browse/GRIFFIN-232
>             Project: Griffin (Incubating)
>          Issue Type: Improvement
>            Reporter: Aleksandr Borgatin
>            Priority: Minor
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> I propose add second type of predicate after "file.exist"  - "custom". JSON 
> example for creation "custom" predicate
> {code:java}
>                      {
>                          "type": "custom",
>                          "config": {
>                            "class": 
> "org.apache.griffin.core.job.FileExistPredicator",
>                            "root.path": "/path/to/",
>                            "path": "file.ext,file2.txt"
>                          }
>                      }
> {code}
> Proposed contract for implementations is based on FileExistPredicator:
>  * class must implement interface *org.apache.griffin.core.job.Predicator*
>  * class must have constructor with argument of type 
> *org.apache.griffin.core.job.entity.SegmentPredicate*



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to