@Override public String getPhysicalColumnName(String logicalName) { if (!getSchema().containsLogicalName(logicalName)) { LOG.warn( "No mapping found for logical name '{}' to physical name on table '{}'. Will use logical name as " + "physical name. This is unexpected and should not happen for properly configured " + "dimensions.", logicalName, getName() ); } return getSchema().getPhysicalColumnName(logicalName); }
/** * Ensure that the schema of the constraint is consistent with what the table supports. * * @param constraint The constraint being tested * * @throws IllegalArgumentException If there are columns referenced by the constraint unavailable in the table */ private void validateConstraintSchema(DataSourceConstraint constraint) throws IllegalArgumentException { Set<String> tableColumnNames = getSchema().getColumnNames(); // Validate that the requested columns are answerable by the current table if (!constraint.getAllColumnNames().stream().allMatch(tableColumnNames::contains)) { String message = String.format( "Received invalid request requesting for columns: %s that is not available in this table: %s", constraint.getAllColumnNames().stream() .filter(name -> !tableColumnNames.contains(name)) .collect(Collectors.joining(",")), getName() ); LOG.error(message); throw new IllegalArgumentException(message); } }
@Override public DateTime getTableAlignment() { return getSchema().getTimeGrain().roundFloor( IntervalUtils.firstMoment(getAllAvailableIntervals().values()).orElse(new DateTime()) ); }
@Override public Map<Column, SimplifiedIntervalList> getAllAvailableIntervals() { return mapToSchemaAvailability( getAvailability().getAllAvailableIntervals(), getSchema() ); }
/** * Create a constrained copy of this table. * * @param constraint The dataSourceConstraint which narrows the view of the underlying availability * * @return a constrained table whose availability and serialization are narrowed by this constraint */ @Override public ConstrainedTable withConstraint(DataSourceConstraint constraint) { validateConstraintSchema(constraint); return new ConstrainedTable(this, new PhysicalDataSourceConstraint(constraint, getSchema())); }
@Override public SimplifiedIntervalList getAvailableIntervals(DataSourceConstraint constraint) { validateConstraintSchema(constraint); return getAvailability().getAvailableIntervals(new PhysicalDataSourceConstraint(constraint, getSchema())); }