[
https://issues.apache.org/jira/browse/YARN-3863?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15160053#comment-15160053
]
Sangjin Lee commented on YARN-3863:
-----------------------------------
Just to clarify my mental model, I am trying to view the logic as something
like the following:
{code}
public static boolean matchRelations(
Map<String, Set<String>> entityRelations,
TimelineFilterList relationFilters) throws IOException {
Operator operator = relationFilters.getOperator();
for (TimelineFilter filter : relationFilters.getFilterList()) {
TimelineFilterType filterType = filter.getFilterType();
boolean matched;
switch (filterType) {
case LIST:
matched = matchRelations(entityRelations, (TimelineFilterList)filter);
break;
case MULTIVAL_EQUALITY:
matched = matchMulValEquality(...); // method that handles multival
equality
break;
default:
throw new IOException("Unsupported filter " + filterType);
}
if (!matched) {
if (operator == AND) {
return false;
}
} else if (operator == OR) {
return true;
}
}
return operator == AND;
}
{code}
Am I far off? In any case, it would be great to make this part of the code
easier to parse, whether it be refactoring of some unit of logic or plenty of
comments.
Also, these methods seem to have similar code. Any possibility of refactoring
the common logic?
> Support complex filters in TimelineReader
> -----------------------------------------
>
> Key: YARN-3863
> URL: https://issues.apache.org/jira/browse/YARN-3863
> Project: Hadoop YARN
> Issue Type: Sub-task
> Affects Versions: YARN-2928
> Reporter: Varun Saxena
> Assignee: Varun Saxena
> Labels: yarn-2928-1st-milestone
> Attachments: YARN-3863-YARN-2928.v2.01.patch,
> YARN-3863-YARN-2928.v2.02.patch, YARN-3863-feature-YARN-2928.wip.003.patch,
> YARN-3863-feature-YARN-2928.wip.01.patch,
> YARN-3863-feature-YARN-2928.wip.02.patch,
> YARN-3863-feature-YARN-2928.wip.04.patch,
> YARN-3863-feature-YARN-2928.wip.05.patch
>
>
> Currently filters in timeline reader will return an entity only if all the
> filter conditions hold true i.e. only AND operation is supported. We can
> support OR operation for the filters as well. Additionally as primary backend
> implementation is HBase, we can design our filters in a manner, where they
> closely resemble HBase Filters.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)