/** * Return a view of the available intervals for this table given a constraint. * * @param constraint The constraint which limits available intervals * * @return The widest set of intervals that the table can report on, given the constraints */ default SimplifiedIntervalList getAvailableIntervals(DataSourceConstraint constraint) { // Default to unconstrained return getAvailableIntervals(); }
/** * Return a view of the available intervals for the original source table given a constraint. * * @param constraint The constraint which limits available intervals * * @return The intervals that the table can report on */ @Override public SimplifiedIntervalList getAvailableIntervals(DataSourceConstraint constraint) { if (getConstraint().equals(constraint)) { return getAvailableIntervals(); } return getSourceTable().getAvailableIntervals(constraint); }
table.getAvailableIntervals(requestConstraint), volatileIntervalsService.getVolatileIntervals(apiRequestGranularity, requestIntervals, table), apiRequestGranularity ); SimplifiedIntervalList tableAvailability = table.getAvailableIntervals(requestConstraint);
/** * Compare two Physical Tables based on how much missing time they have. * * @param left The first table * @param right The second table * * @return negative if table1 has less missing time than table2 */ @Override public int compare(PhysicalTable left, PhysicalTable right) { // choose table with most data available for given columns long missingDurationLeft = IntervalUtils.getTotalDuration( partialDataHandler.findMissingTimeGrainIntervals( left.getAvailableIntervals(requestConstraint), new SimplifiedIntervalList(requestConstraint.getIntervals()), requestConstraint.getRequestGranularity() ) ); long missingDurationRight = IntervalUtils.getTotalDuration( partialDataHandler.findMissingTimeGrainIntervals( right.getAvailableIntervals(requestConstraint), new SimplifiedIntervalList(requestConstraint.getIntervals()), requestConstraint.getRequestGranularity() ) ); long difference = missingDurationLeft - missingDurationRight; return (int) Math.max(Math.min(Integer.MAX_VALUE, difference), Integer.MIN_VALUE); } }