/** * Get the logging blocks that need to be at the "head" of the log output. * * @param order Indication of order of the initial blocks. * * @return the blocks in order */ private static List<String> generateLogInfoOrder(String order) { return Arrays.stream(order.replaceAll("\\s+", "").split(",")) .filter(not(String::isEmpty)) .map(name -> "com.yahoo.bard.webservice.logging.blocks." + name) .collect(Collectors.toList()); } }
/** * Gather duplicate names across the collection of Aggregations and PostAggregations. * * @param aggregations Set of Aggregations to inspect * @param postAggregations Set of PostAggregations to inspect * * @return Set of collided names (if any) */ private Set<String> getNameCollisions( Collection<Aggregation> aggregations, Collection<PostAggregation> postAggregations ) { Set<String> allNames = new HashSet<>(); return Stream.concat(aggregations.stream(), postAggregations.stream()) .map(MetricField::getName) .filter(not(allNames::add)) // Select names that already had been added to allNames .collect(Collectors.toSet()); }
@Override public boolean test(PhysicalTable table) { Set<String> columnNames = requestConstraint.getAllColumnNames(); // If table contains non-agg dimensions, query must contain all these non-agg dimensions to use this table. return table.getDimensions().stream() .filter(StreamUtils.not(Dimension::isAggregatable)) .map(Dimension::getApiName) .allMatch(columnNames::contains); }
@Override public NoMatchFoundException noneFoundException() { Set<String> aggDimensions = requestConstraint.getRequestDimensions().stream() .filter(Dimension::isAggregatable) .map(Dimension::getApiName) .collect(Collectors.toSet()); Set<String> nonAggDimensions = requestConstraint.getRequestDimensions().stream() .filter(StreamUtils.not(Dimension::isAggregatable)) .map(Dimension::getApiName) .collect(Collectors.toSet()); LOG.error(MESSAGE_FORMAT.logFormat(nonAggDimensions, aggDimensions)); return new NoMatchFoundException(MESSAGE_FORMAT.format(nonAggDimensions, aggDimensions)); } }
.filter(StreamUtils.not(Dimension::isAggregatable)) .collect(Collectors.toSet());