@Override
  public int compare(TaskWrapper t1, TaskWrapper t2) {
    TaskRunnerCallable o1 = t1.getTaskRunnerCallable();
    TaskRunnerCallable o2 = t2.getTaskRunnerCallable();

    // Regardless of other criteria, ducks are always more important than non-ducks.
    boolean v1 = o1.isGuaranteed(), v2 = o2.isGuaranteed();
    if (v1 != v2) return v1 ? -1 : 1;

    // Then, finishable must always precede non-finishable.
    v1 = o1.canFinishForPriority();
    v2 = o2.canFinishForPriority();
    if (v1 != v2) return v1 ? -1 : 1;

    // Note: query priorities, if we add them, might go here.

    // After that, a heuristic is used to decide.
    return compareInternal(o1, o2);
  }
The base class for LLAP queue comparators that checks the criteria that always apply for task
priorities, and then lets the specific implementations deal with heuristics, etc.
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/impl/comparator/LlapQueueComparatorBase.java