Skip to content

Commit

Permalink
Allow using months filter for daily partitioned checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrczarnas committed Jan 20, 2024
1 parent e9142d6 commit ee69c81
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,12 @@ public TimeWindowFilterParameters makeEffectiveIncrementalFilter(
TableSpec tableSpec,
TimeSeriesConfigurationSpec timeSeriesConfigurationSpec,
TimeWindowFilterParameters userTimeWindowFilters) {
if (userTimeWindowFilters != null && userTimeWindowFilters.hasAnyParametersApplied()) {
return userTimeWindowFilters;
}

if (timeSeriesConfigurationSpec.getMode() == TimeSeriesMode.current_time) {
return userTimeWindowFilters != null ? userTimeWindowFilters : new TimeWindowFilterParameters();
return new TimeWindowFilterParameters();
}

PartitionIncrementalTimeWindowSpec tableTimeWindowSpec = tableSpec.getIncrementalTimeWindow();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,24 @@ public TimeWindowFilterParameters withUserFilters(TimeWindowFilterParameters use
return cloned;
}

/**
* Detects if any filter parameter is set, so the user did not send an empty filter object.
* If DQOps receives an empty time window, the default time window configured on the table is used.
* @return True when any filters are applied, false when it is an empty (dummy) filter, to be ignored.
*/
public boolean hasAnyParametersApplied() {
return dailyPartitioningRecentDays != null ||
dailyPartitioningIncludeToday != null ||
monthlyPartitioningRecentMonths != null ||
monthlyPartitioningIncludeCurrentMonth != null ||
fromDate != null ||
fromDateTime != null ||
fromDateTimeOffset != null ||
toDate != null ||
toDateTime != null ||
toDateTimeOffset != null;
}

/**
* Creates and returns a copy of this object (deep clone).
*/
Expand Down

0 comments on commit ee69c81

Please sign in to comment.