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

Rajat Khandelwal commented on LENS-1373:
----------------------------------------

Our code is doing the following:

{noformat}
      Class<?>[] classes = conf.getClasses(QUERY_COMPARATOR_CLASSES,
        MoreRetriesFirstComparator.class, QueryPriorityComparator.class, 
FIFOQueryComparator.class);

{noformat}

The signature of the function getClasses is as per the following:

{noformat}

  /** 
   * Get the value of the <code>name</code> property
   * as an array of <code>Class</code>.
   * The value of the property specifies a list of comma separated class names. 
 
   * If no such property is specified, then <code>defaultValue</code> is 
   * returned.
   * 
   * @param name the property name.
   * @param defaultValue default value.
   * @return property value as a <code>Class[]</code>, 
   *         or <code>defaultValue</code>. 
   */
  public Class<?>[] getClasses(String name, Class<?> ... defaultValue) {
    String[] classnames = getTrimmedStrings(name);
    if (classnames == null)
      return defaultValue;
    try {
      Class<?>[] classes = new Class<?>[classnames.length];
      for(int i = 0; i < classnames.length; i++) {
        classes[i] = getClassByName(classnames[i]);
      }
      return classes;
    } catch (ClassNotFoundException e) {
      throw new RuntimeException(e);
    }
  }

{noformat}

The issue is, getTrimmedStrings never returns null. It returns zero size array 
in case there is no value set for the key. So the default values are never 
returned. Seems like a problem in hadoop code. 

> Specify chain of comparators in lensserver-default.xml
> ------------------------------------------------------
>
>                 Key: LENS-1373
>                 URL: https://issues.apache.org/jira/browse/LENS-1373
>             Project: Apache Lens
>          Issue Type: Task
>            Reporter: Rajat Khandelwal
>            Assignee: Rajat Khandelwal
>         Attachments: LENS-1373.2016-11-07_17:09:24.patch
>
>
> Queries are compared in the following order:
> 1. More retries first
> 2. Higher priority first
> 3. FIFO
> The default value is added in code, but not in lensserver-defaults.xml. 
> Adding to either places should have been enough but seems like that's not 
> happening. Will investigate more and raise another bug if that's the case. 
> This jira is just for adding the defaults in xml file. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to