geode-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GEODE-2936) Refactor OrderByComparator's compare method to reduce redundant code
Date Wed, 14 Jun 2017 20:29:00 GMT

    [ https://issues.apache.org/jira/browse/GEODE-2936?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16049621#comment-16049621
] 

ASF GitHub Bot commented on GEODE-2936:
---------------------------------------

Github user YehEmily commented on a diff in the pull request:

    https://github.com/apache/geode/pull/580#discussion_r122055572
  
    --- Diff: geode-core/src/main/java/org/apache/geode/cache/query/internal/OrderByComparator.java
---
    @@ -45,78 +44,50 @@ public OrderByComparator(List<CompiledSortCriterion> orderByAttrs,
ObjectType ob
       }
     
       /**
    -   * Yogesh : This methods evaluates sort criteria and returns a ArrayList of Object[]
arrays of
    -   * evaluated criteria
    +   * This method evaluates sort criteria and returns an ArrayList of Object[] arrays
of the
    +   * evaluated criteria.
        * 
    -   * @param value
    -   * @return Object[]
    +   * @param value the criteria to be evaluated.
    +   * @return an Object array of Object arrays of the evaluated criteria.
        */
       protected Object[] evaluateSortCriteria(Object value) {
    -
         CompiledSortCriterion csc;
         Object[] array = null;
         if (orderByAttrs != null) {
           array = new Object[orderByAttrs.size()];
    -      Iterator orderiter = orderByAttrs.iterator();
    +      Iterator orderIter = orderByAttrs.iterator();
           int i = 0;
    -      while (orderiter.hasNext()) {
    -        csc = (CompiledSortCriterion) orderiter.next();
    -        Object[] arr = new Object[2];
    -        arr[0] = csc.evaluate(value, context);
    -        arr[1] = Boolean.valueOf(csc.getCriterion());
    +      while (orderIter.hasNext()) {
    --- End diff --
    
    Fixed, and updating the PR now - thank you!


> Refactor OrderByComparator's compare method to reduce redundant code
> --------------------------------------------------------------------
>
>                 Key: GEODE-2936
>                 URL: https://issues.apache.org/jira/browse/GEODE-2936
>             Project: Geode
>          Issue Type: Bug
>          Components: querying
>            Reporter: nabarun
>            Assignee: Emily Yeh
>
> Issue:
> OrderByComparator's compare method has a lot of redundant code.
> Solution:
> These code sections can be modified to have one method call



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message