/** * Given a column type and name, return the column of the expected type. * * @param name The name on the column * @param columnClass The class of the column being retrieved * @param <T> The type of the subclass of the column being retrieved * * @return The an optional containing the column of the name and type specified, if any */ default <T extends Column> Optional<T> getColumn(String name, Class<T> columnClass) { return getColumns(columnClass).stream() .filter(column -> column.getName().equals(name)) .findFirst(); } }
/** * Map availabilities in schema-less columns to a {@link Column} keyed availability map for a given table. * * @param rawIntervals The map of physical name to {@link SimplifiedIntervalList}s as the source availability * @param schema The schema describing the columns of this table, which includes the logical -> physical * mappings * * @return map of column to set of available intervals */ default Map<Column, SimplifiedIntervalList> mapToSchemaAvailability( Map<String, SimplifiedIntervalList> rawIntervals, PhysicalTableSchema schema ) { return schema.getColumns().stream() .collect( Collectors.toMap( Function.identity(), column -> rawIntervals.getOrDefault( schema.getPhysicalColumnName(column.getName()), new SimplifiedIntervalList() ) ) ); } }
dimensionsResult.add(row); } else { row.put("name", key.getName()); metricsResult.add(row);