Class InlineReindexingRuleProvider

java.lang.Object
org.apache.druid.server.compaction.InlineReindexingRuleProvider
All Implemented Interfaces:
ReindexingRuleProvider

public class InlineReindexingRuleProvider extends Object implements ReindexingRuleProvider
Rule provider that returns a static list of rules defined inline in the configuration.

This is the simplest provider implementation, suitable for testing and use cases where the number of rules is relatively small and can be defined directly in the supervisor spec.

When filtering rules by interval, this provider only returns rules where ReindexingRule.appliesTo(Interval, DateTime) returns ReindexingRule.AppliesToMode.FULL. Rules with partial or no overlap are excluded.

For non-additive rule types, when multiple rules fully match an interval, only the rule with the oldest threshold (largest period) is returned. For example, if both a P30D and P90D partitioning rule match an interval, the P90D rule is selected because it has the oldest threshold (now - 90 days is older than now - 30 days).

Example usage:


 {
   "type": "inline",
   "reindexingDeletionRules": [
     {
       "id": "remove-bots-90d",
       "olderThan": "P90D",
       "deleteWhere": {
         "type": "not",
         "field": {
           "type": "equals",
           "column": "is_bot",
           "matchValueType": "STRING"
           "matchValue": "true"
         }
       },
       "description": "Remove bot traffic from segments older than 90 days"
     },
     {
       "id": "remove-low-priority-180d",
       "olderThan": "P180D",
       "deleteWhere": {
         "type": "not",
         "field": {
           {
             "type": "inType",
             "column": "priority",
             "matchValueType": "STRING",
             "sortedValues": ["low", "spam"]
           }
         }
       },
       "description": "Remove low-priority data from segments older than 180 days"
     }
   ]
 }
 
  • Field Details

  • Constructor Details

  • Method Details

    • builder

      public static InlineReindexingRuleProvider.Builder builder()
    • getType

      public String getType()
      Description copied from interface: ReindexingRuleProvider
      Returns the type identifier for this provider implementation.

      This value is used in JSON serialization to identify which provider implementation to use when deserializing.

      Specified by:
      getType in interface ReindexingRuleProvider
      Returns:
      the type identifier (e.g., "inline", "external")
    • getDeletionRules

      public List<ReindexingDeletionRule> getDeletionRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing deletion rules.
      Specified by:
      getDeletionRules in interface ReindexingRuleProvider
    • getDataSchemaRule

      @Nullable public ReindexingDataSchemaRule getDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns the matched reindexing data schema rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Specified by:
      getDataSchemaRule in interface ReindexingRuleProvider
      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      ReindexingDataSchemaRule rule that applies to the given interval.
    • getDataSchemaRules

      public List<ReindexingDataSchemaRule> getDataSchemaRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing data schema rules.
      Specified by:
      getDataSchemaRules in interface ReindexingRuleProvider
    • getPartitioningRules

      public List<ReindexingPartitioningRule> getPartitioningRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing partitioning rules.
      Specified by:
      getPartitioningRules in interface ReindexingRuleProvider
    • getIndexSpecRules

      public List<ReindexingIndexSpecRule> getIndexSpecRules()
      Description copied from interface: ReindexingRuleProvider
      Returns ALL reindexing index spec rules.
      Specified by:
      getIndexSpecRules in interface ReindexingRuleProvider
    • getDeletionRules

      public List<ReindexingDeletionRule> getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns all reindexing deletion rules that apply to the given interval.

      Handling partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Specified by:
      getDeletionRules in interface ReindexingRuleProvider
      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      The list of ReindexingDeletionRule rules that apply to the given interval.
    • getPartitioningRule

      @Nullable public ReindexingPartitioningRule getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns the matched reindexing partitioning rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Specified by:
      getPartitioningRule in interface ReindexingRuleProvider
      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
      Returns:
      ReindexingPartitioningRule rule that applies to the given interval.
    • getIndexSpecRule

      @Nullable public ReindexingIndexSpecRule getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime)
      Description copied from interface: ReindexingRuleProvider
      Returns the matched reindexing index spec rule that applies to the given interval.

      Handling cases of multiple applicable rules and/or partial overlaps is the responsibility of the provider implementation and should be clearly documented.

      Specified by:
      getIndexSpecRule in interface ReindexingRuleProvider
      Parameters:
      interval - The interval to check applicability against.
      referenceTime - The reference time to use for period calculations while determining rule applicability for an interval. e.g., a rule with period P7D applies to data older than 7 days from the reference time.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object