public final class IgnoreNullMetrics extends OptimizerRules.OptimizerRule<TimeSeriesAggregate>

NOTE: THIS RULE IS INTENDED TO BE RUN ONLY ONCE. DO NOT INCLUDE IT IN MULTI-RUN BATCHES. The expectation is that this will be run as part of the LocalLogicalPlanOptimizer in the local rewrite batch

TSDB often ends up storing many null values for metrics columns (since not every time series contains every metric). However, loading many null values can negatively impact query performance. To reduce that, this rule applies filters to remove null values on all metrics involved in the query. In the case that there are multiple metrics, the not null checks are OR'd together, so we accept rows where any of the metrics have values.