/** * Constructor. * * @param name Name that represents set of fact table names that are put together under this table * @param timeGrain The time grain of the table. The time grain has to satisfy all grains of the tables * @param columns The columns for this table * @param physicalTables A set of PhysicalTables that are put together under this table. The * tables shall have zoned time grains that all satisfy the provided timeGrain * @param logicalToPhysicalColumnNames Mappings from logical to physical names * @param availability The Availability of this table */ public BaseCompositePhysicalTable( @NotNull TableName name, @NotNull ZonedTimeGrain timeGrain, @NotNull Set<Column> columns, @NotNull Set<? extends PhysicalTable> physicalTables, @NotNull Map<String, String> logicalToPhysicalColumnNames, @NotNull Availability availability ) { super( name, timeGrain, columns, logicalToPhysicalColumnNames, availability ); verifyGrainSatisfiesAllSourceTables(getSchema().getTimeGrain(), physicalTables); }
@Override public ConfigPhysicalTable build(ResourceDictionaries dictionaries, DataSourceMetadataService metadataService) { try { Map<ConfigPhysicalTable, Set<String>> tableMetricNamesMap = getTableToMetricsMap(dictionaries); validateDependentMetrics(tableMetricNamesMap); return new BaseCompositePhysicalTable( getName(), getTimeGrain(), buildColumns(dictionaries.getDimensionDictionary()), tableMetricNamesMap.keySet(), getLogicalToPhysicalNames(), MetricUnionAvailability.build( tableMetricNamesMap.keySet(), tableMetricNamesMap.entrySet().stream() .collect(Collectors.toMap( entry -> entry.getKey().getAvailability(), Map.Entry::getValue ))) ); } catch (IllegalArgumentException e) { String message = String.format(VALIDATION_ERROR_FORMAT, e.getMessage()); LOG.error(message); throw new IllegalArgumentException(message); } }
@Override public ConfigPhysicalTable build(ResourceDictionaries dictionaries, DataSourceMetadataService metadataService) { Map<ConfigPhysicalTable, DataSourceFilter> availabilityFilters = tablePartDefinitions.entrySet().stream() .collect(Collectors.toMap( entry -> dictionaries.getPhysicalDictionary().get(entry.getKey().asName()), entry -> new DimensionIdFilter(toDimensionValuesMap( entry.getValue(), dictionaries.getDimensionDictionary() )) )); return new BaseCompositePhysicalTable( getName(), getTimeGrain(), buildColumns(dictionaries.getDimensionDictionary()), availabilityFilters.keySet(), getLogicalToPhysicalNames(), PartitionAvailability.build(availabilityFilters) ); }