/** * Constructor. * * @param tableGroup The table group used to initial this logical table * @param granularity The granularity for this schema * @param metricDictionary The dictionary to resolve metric names from the table group against */ public LogicalTableSchema(TableGroup tableGroup, Granularity granularity, MetricDictionary metricDictionary) { super(granularity, buildLogicalColumns(tableGroup, granularity, metricDictionary)); }
public Granularity getGranularity() { return schema.getGranularity(); }
public Set<LogicalMetric> getLogicalMetrics() { return schema.getColumns(LogicalMetricColumn.class).stream() .map(LogicalMetricColumn::getLogicalMetric) .collect(Collectors.toCollection(LinkedHashSet::new)); }
this.comparableParam = name + granularity.toString(); schema = new LogicalTableSchema(tableGroup, granularity, metricDictionary);
/** * Convert the tables in the table group to a set of dimension and metric columns. * * @param tableGroup The collection of table group physical tables. * @param granularity The granularity for this schema * @param metricDictionary The dictionary to build logical metrics from names. * * @return The union of all columns from the table group */ private static LinkedHashSet<Column> buildLogicalColumns( TableGroup tableGroup, Granularity granularity, MetricDictionary metricDictionary ) { return Stream.concat( tableGroup.getDimensions().stream() .map(DimensionColumn::new), buildMetricColumns(tableGroup.getApiMetricNames(), granularity, metricDictionary) ).collect(Collectors.toCollection(LinkedHashSet::new)); }