クラスタリングのCounts値のマージを行う。

@param baseCounts ベースCounts
@param targetCounts マージ対象Counts
@param resultMapping ベース学習モデルとマージ対象学習モデルの中心点マッピング
@return マージ結果Counts
496656
protected static List<Long> mergeCounts(List<Long> baseCounts, List<Long> targetCounts,
            Map<Integer, Integer> resultMapping)
    {
        int countNum = resultMapping.size();
        List<Long> mergedCounts = new ArrayList<>(countNum);
        for (int count = 0; count < countNum; count++)
        {
            mergedCounts.add(0L);
        }

        for (Entry<Integer, Integer> resultEntry : resultMapping.entrySet())
        {
            mergedCounts.set(resultEntry.getKey(), baseCounts.get(resultEntry.getKey())
                    + targetCounts.get(resultEntry.getValue()));
        }

        return mergedCounts;
    }
661567
public static Long executeAutoCount(Dialect dialect, Executor executor, MappedStatement countMs,
                                        Object parameter, BoundSql boundSql,
                                        RowBounds rowBounds, ResultHandler resultHandler) throws SQLException {
        Map<String, Object> additionalParameters = getAdditionalParameter(boundSql);
        //创建 count 查询的缓存 key
        CacheKey countKey = executor.createCacheKey(countMs, parameter, RowBounds.DEFAULT, boundSql);
        //调用方言获取 count sql
        String countSql = dialect.getCountSql(countMs, boundSql, parameter, rowBounds, countKey);
        //countKey.update(countSql);
        BoundSql countBoundSql = new BoundSql(countMs.getConfiguration(), countSql, boundSql.getParameterMappings(), parameter);
        //当使用动态 SQL 时，可能会产生临时的参数，这些参数需要手动设置到新的 BoundSql 中
        for (String key : additionalParameters.keySet()) {
            countBoundSql.setAdditionalParameter(key, additionalParameters.get(key));
        }
        //执行 count 查询
        Object countResultList = executor.query(countMs, parameter, RowBounds.DEFAULT, resultHandler, countKey, countBoundSql);
        Long count = (Long) ((List) countResultList).get(0);
        return count;
    }
1302522
public void update(final List<Long> groupTargetCounts, final Long totalTargetCount) {
        this.groupTargetCounts = groupTargetCounts;
        this.totalTargetCount = totalTargetCount;

        if (groupTargetCounts != null) {
            long sum = 0;
            for (Long targetCount : groupTargetCounts) {
                sum += targetCount;
            }
            unassignedTargets = totalTargetCount - sum;
        }

        draw();

    }
1304741
@Override
  public SortedMap<String, Counter> getCounters(MetricFilter filter) {
    return getSimplyNamedMetrics(Counter.class, Optional.of(filter));
  }
118077
public static Long executeManualCount(Executor executor, MappedStatement countMs,
                                          Object parameter, BoundSql boundSql,
                                          ResultHandler resultHandler) throws SQLException {
        CacheKey countKey = executor.createCacheKey(countMs, parameter, RowBounds.DEFAULT, boundSql);
        BoundSql countBoundSql = countMs.getBoundSql(parameter);
        Object countResultList = executor.query(countMs, parameter, RowBounds.DEFAULT, resultHandler, countKey, countBoundSql);
        Long count = ((Number) ((List) countResultList).get(0)).longValue();
        return count;
    }
798985
public static <T extends AbstractJaxb> List<T> getDescendants(T target,
            List<T> resultList, String clazz) {
        return execute(target, resultList, null, clazz);
    }
149784
private static <E> Counter<Integer> collectCountCounts(Counter<E> counts) {
    Counter<Integer> cc = new ClassicCounter<Integer>(); // counts of counts
    for (Map.Entry<E, Double> entry : counts.entrySet()) {
      //E item = entry.getKey();
      Integer count = (int) Math.round(entry.getValue());
      cc.incrementCount(count);
    }
    return cc;
  }
1269262
public int getStatistics(String datasourceId, String mappingId) {
		final HashMap<String, Integer> mappingStat = getStatistics(datasourceId);
		int triplesCount = mappingStat.get(mappingId).intValue();

		return triplesCount;
	}
527309
private VoltTable[] aggregateProcedureInputStats(VoltTable[] baseStats)
    {
        if (baseStats == null || baseStats.length != 1) {
            return baseStats;
        }

        StatsProcInputTable timeTable = new StatsProcInputTable();
        baseStats[0].resetRowPosition();
        while (baseStats[0].advanceRow()) {
            // Skip non-transactional procedures for some of these rollups until
            // we figure out how to make them less confusing.
            // NB: They still show up in the raw PROCEDURE stata.
            boolean transactional = baseStats[0].getLong("TRANSACTIONAL") == 1;
            if (!transactional) {
                continue;
            }

            if ( ! baseStats[0].getString("STATEMENT").equalsIgnoreCase("<ALL>")) {
                continue;
            }
            String pname = baseStats[0].getString("PROCEDURE");
            timeTable.updateTable(!isReadOnlyProcedure(pname),
                    pname,
                    baseStats[0].getLong("PARTITION_ID"),
                    baseStats[0].getLong("TIMESTAMP"),
                    baseStats[0].getLong("INVOCATIONS"),
                    baseStats[0].getLong("MIN_PARAMETER_SET_SIZE"),
                    baseStats[0].getLong("MAX_PARAMETER_SET_SIZE"),
                    baseStats[0].getLong("AVG_PARAMETER_SET_SIZE")
                    );
        }
        return new VoltTable[] { timeTable.sortByInput("PROCEDURE_INPUT") };
    }
1198022
@Override
  public SortedMap<String, Counter> getCounters(MetricFilter filter) {
    return this.innerMetricContext.getCounters(filter);
  }
457231
private boolean targetContainsInstance(GraqlCompute.Statistics.Value query) {
        for (Label attributeType : targetTypeLabels(query)) {
            for (Label type : scopeTypeLabels(query)) {
                Boolean patternExist = tx.stream(Graql.match(
                        Graql.var("x").has(attributeType.getValue(), Graql.var()),
                        Graql.var("x").isa(Graql.type(type.getValue()))
                ), false).iterator().hasNext();
                if (patternExist) return true;
            }
        }
        return false;
        //TODO: should use the following ask query when ask query is even lazier
//        List<Pattern> checkResourceTypes = statisticsResourceTypes.stream()
//                .map(type -> var("x").has(type, var())).collect(Collectors.toList());
//        List<Pattern> checkSubtypes = inTypes.stream()
//                .map(type -> var("x").isa(Graql.label(type))).collect(Collectors.toList());
//
//        return tx.get().graql().infer(false)
//                .match(or(checkResourceTypes), or(checkSubtypes)).get().aggregate(ask()).execute();
    }
338968
public static <T> IQueryResult<T> packageResult(List<T> results) {
        return packageResult(results, null);
    }
52751
public List<Long> getMappingsForBase(String tableName, long baseId) {

		List<Long> relatedIds = new ArrayList<>();

		UserMappingDao userMappingDao = getMappingDao(tableName);
		UserCustomResultSet resultSet = userMappingDao.queryByBaseId(baseId);
		try {
			while (resultSet.moveToNext()) {
				UserMappingRow row = userMappingDao.getRow(resultSet);
				relatedIds.add(row.getRelatedId());
			}
		} finally {
			resultSet.close();
		}

		return relatedIds;
	}
332961
public <T> DynamicJdbcMapper<T> newMapper(final Class<T> target) {
		return newMapper((Type) target);
	}
258449
private void checkByTargetFilterQueryAndAssignDS(final TargetFilterQuery targetFilterQuery) {
        try {
            final DistributionSet distributionSet = targetFilterQuery.getAutoAssignDistributionSet();

            int count;
            do {

                count = runTransactionalAssignment(targetFilterQuery, distributionSet.getId());

            } while (count == PAGE_SIZE);

        } catch (PersistenceException | AbstractServerRtException e) {
            LOGGER.error("Error during auto assign check of target filter query " + targetFilterQuery.getId(), e);
        }

    }
620250
private List<EntityType> getNewSources(MappingTarget target) {
    return dataService
        .getEntityTypeIds()
        .filter(name -> isValidSource(target, name))
        .map(dataService::getEntityType)
        .collect(toList());
  }
149859
public Counters getCounters() {
    Counters result = new Counters();
    synchronized (this) {
      result.incrAllCounters(getJobCounters());
    }

    incrementTaskCounters(result, maps);
    return incrementTaskCounters(result, reduces);
  }