test_class.file: tajo-core/src/test/java/org/apache/tajo/util/TestJSPUtil.java
test_class.identifier: TestJSPUtil
test_case.body: @Test
    public void testSortQueryUnit() throws Exception {
      List<QueryUnit> queryUnits = new ArrayList<QueryUnit>();
  
      Configuration conf = new TajoConf();
  
      QueryUnitAttemptScheduleEvent.QueryUnitAttemptScheduleContext scheduleContext =
          new QueryUnitAttemptScheduleEvent.QueryUnitAttemptScheduleContext();
  
      ExecutionBlockId ebId = TajoIdUtils.createExecutionBlockId("eb_000001_00001_00001");
  
      for (int i = 0; i < 10; i++) {
        QueryUnitId id = new QueryUnitId(ebId, i);
        QueryUnit queryUnit = new QueryUnit(conf, scheduleContext, id, true, null);
        queryUnits.add(queryUnit);
  
        int launchTime = i + 1;
        int runningTime = i + 1;
        if(i < 9) {
          queryUnit.setLaunchTime(launchTime);
          queryUnit.setFinishTime(launchTime + runningTime);
        }
      }
  
      Collections.shuffle(queryUnits);
  
      QueryUnit[] queryUnitArray = queryUnits.toArray(new QueryUnit[]{});
      JSPUtil.sortQueryUnit(queryUnitArray, "id", "asc");
      for (int i = 0; i < 10; i++) {
        assertEquals(i, queryUnitArray[i].getId().getId());
      }
  
      queryUnitArray = queryUnits.toArray(new QueryUnit[]{});
      JSPUtil.sortQueryUnit(queryUnitArray, "id", "desc");
      for (int i = 0; i < 10; i++) {
        assertEquals(9 - i, queryUnitArray[i].getId().getId());
      }
  
      queryUnitArray = queryUnits.toArray(new QueryUnit[]{});
      JSPUtil.sortQueryUnit(queryUnitArray, "runTime", "asc");
      assertEquals(0, queryUnitArray[0].getId().getId());
      assertEquals(9, queryUnitArray[9].getId().getId());
  
      queryUnitArray = queryUnits.toArray(new QueryUnit[]{});
      JSPUtil.sortQueryUnit(queryUnitArray, "runTime", "desc");
      assertEquals(8, queryUnitArray[0].getId().getId());
      assertEquals(9, queryUnitArray[9].getId().getId());
    }
test_case.class_method_signature: TestJSPUtil.testSortQueryUnit()
test_case.full_signature: @Test public void testSortQueryUnit()
test_case.identifier: testSortQueryUnit
test_case.invocations: createExecutionBlockId add setLaunchTime setFinishTime shuffle toArray sortQueryUnit assertEquals getId getId toArray sortQueryUnit assertEquals getId getId toArray sortQueryUnit assertEquals getId getId assertEquals getId getId toArray sortQueryUnit assertEquals getId getId assertEquals getId getId
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testSortQueryUnit()
focal_class.declarator: decimalF = new DecimalFormat("###.0")
focal_class.modifier: static
focal_class.original_string: static DecimalFormat decimalF = new DecimalFormat("###.0");
focal_class.type: DecimalFormat
focal_class.var_name: decimalF
focal_class.declarator: PERCENT_FORMAT = new DecimalFormat("###.0")
focal_class.modifier: static final
focal_class.original_string: static final DecimalFormat PERCENT_FORMAT = new DecimalFormat("###.0");
focal_class.type: DecimalFormat
focal_class.var_name: PERCENT_FORMAT
focal_class.file: tajo-core/src/main/java/org/apache/tajo/util/JSPUtil.java
focal_class.identifier: JSPUtil
focal_class.class_method_signature: JSPUtil.sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_class.full_signature: public static void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_class.identifier: sortQueryUnit
focal_class.modifiers: public static
focal_class.parameters: (QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_class.return: void
focal_class.signature: void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_class.class_method_signature: JSPUtil.sortTaskRunner(List<TaskRunner> taskRunners)
focal_class.full_signature: public static void sortTaskRunner(List<TaskRunner> taskRunners)
focal_class.identifier: sortTaskRunner
focal_class.modifiers: public static
focal_class.parameters: (List<TaskRunner> taskRunners)
focal_class.return: void
focal_class.signature: void sortTaskRunner(List<TaskRunner> taskRunners)
focal_class.class_method_signature: JSPUtil.getElapsedTime(long startTime, long finishTime)
focal_class.full_signature: public static String getElapsedTime(long startTime, long finishTime)
focal_class.identifier: getElapsedTime
focal_class.modifiers: public static
focal_class.parameters: (long startTime, long finishTime)
focal_class.return: String
focal_class.signature: String getElapsedTime(long startTime, long finishTime)
focal_class.class_method_signature: JSPUtil.getTajoMasterHttpAddr(Configuration config)
focal_class.full_signature: public static String getTajoMasterHttpAddr(Configuration config)
focal_class.identifier: getTajoMasterHttpAddr
focal_class.modifiers: public static
focal_class.parameters: (Configuration config)
focal_class.return: String
focal_class.signature: String getTajoMasterHttpAddr(Configuration config)
focal_class.class_method_signature: JSPUtil.sortQueryMasterTask(Collection<QueryMasterTask> queryMasterTasks,
                                                            final boolean desc)
focal_class.full_signature: public static List<QueryMasterTask> sortQueryMasterTask(Collection<QueryMasterTask> queryMasterTasks,
                                                            final boolean desc)
focal_class.identifier: sortQueryMasterTask
focal_class.modifiers: public static
focal_class.parameters: (Collection<QueryMasterTask> queryMasterTasks,
                                                            final boolean desc)
focal_class.return: List<QueryMasterTask>
focal_class.signature: List<QueryMasterTask> sortQueryMasterTask(Collection<QueryMasterTask> queryMasterTasks,
                                                            final boolean desc)
focal_class.class_method_signature: JSPUtil.sortQueryInProgress(Collection<QueryInProgress> queryInProgresses,
                                                            final boolean desc)
focal_class.full_signature: public static List<QueryInProgress> sortQueryInProgress(Collection<QueryInProgress> queryInProgresses,
                                                            final boolean desc)
focal_class.identifier: sortQueryInProgress
focal_class.modifiers: public static
focal_class.parameters: (Collection<QueryInProgress> queryInProgresses,
                                                            final boolean desc)
focal_class.return: List<QueryInProgress>
focal_class.signature: List<QueryInProgress> sortQueryInProgress(Collection<QueryInProgress> queryInProgresses,
                                                            final boolean desc)
focal_class.class_method_signature: JSPUtil.sortSubQuery(Collection<SubQuery> subQueries)
focal_class.full_signature: public static List<SubQuery> sortSubQuery(Collection<SubQuery> subQueries)
focal_class.identifier: sortSubQuery
focal_class.modifiers: public static
focal_class.parameters: (Collection<SubQuery> subQueries)
focal_class.return: List<SubQuery>
focal_class.signature: List<SubQuery> sortSubQuery(Collection<SubQuery> subQueries)
focal_class.class_method_signature: JSPUtil.compareLong(long a, long b)
focal_class.full_signature: static int compareLong(long a, long b)
focal_class.identifier: compareLong
focal_class.modifiers: static
focal_class.parameters: (long a, long b)
focal_class.return: int
focal_class.signature: int compareLong(long a, long b)
focal_class.class_method_signature: JSPUtil.sortFunctionDesc(List<FunctionDesc> functions)
focal_class.full_signature: public static void sortFunctionDesc(List<FunctionDesc> functions)
focal_class.identifier: sortFunctionDesc
focal_class.modifiers: public static
focal_class.parameters: (List<FunctionDesc> functions)
focal_class.return: void
focal_class.signature: void sortFunctionDesc(List<FunctionDesc> functions)
focal_class.class_method_signature: JSPUtil.percentFormat(float value)
focal_class.full_signature: public static String percentFormat(float value)
focal_class.identifier: percentFormat
focal_class.modifiers: public static
focal_class.parameters: (float value)
focal_class.return: String
focal_class.signature: String percentFormat(float value)
focal_method.body: public static void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder) {
      if(sortField == null || sortField.isEmpty()) {
        sortField = "id";
      }
  
      Arrays.sort(queryUnits, new QueryUnitComparator(sortField, "asc".equals(sortOrder)));
    }
focal_method.class_method_signature: JSPUtil.sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_method.full_signature: public static void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_method.identifier: sortQueryUnit
focal_method.invocations: isEmpty sort equals
focal_method.modifiers: public static
focal_method.parameters: (QueryUnit[] queryUnits, String sortField, String sortOrder)
focal_method.return: void
focal_method.signature: void sortQueryUnit(QueryUnit[] queryUnits, String sortField, String sortOrder)