Class InlineReindexingRuleProvider
- All Implemented Interfaces:
ReindexingRuleProvider
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"
}
]
}
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInlineReindexingRuleProvider(List<ReindexingDeletionRule> deletionRules, List<ReindexingPartitioningRule> partitioningRules, List<ReindexingIndexSpecRule> indexSpecRules, List<ReindexingDataSchemaRule> dataSchemaRules) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleangetDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing data schema rule that applies to the given interval.Returns ALL reindexing data schema rules.Returns ALL reindexing deletion rules.getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns all reindexing deletion rules that apply to the given interval.getIndexSpecRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing index spec rule that applies to the given interval.Returns ALL reindexing index spec rules.getPartitioningRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Returns the matched reindexing partitioning rule that applies to the given interval.Returns ALL reindexing partitioning rules.getType()Returns the type identifier for this provider implementation.inthashCode()toString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.druid.server.compaction.ReindexingRuleProvider
isReady, streamAllRules
-
Field Details
-
TYPE
- See Also:
-
-
Constructor Details
-
InlineReindexingRuleProvider
public InlineReindexingRuleProvider(@Nullable List<ReindexingDeletionRule> deletionRules, @Nullable List<ReindexingPartitioningRule> partitioningRules, @Nullable List<ReindexingIndexSpecRule> indexSpecRules, @Nullable List<ReindexingDataSchemaRule> dataSchemaRules)
-
-
Method Details
-
builder
-
getType
Description copied from interface:ReindexingRuleProviderReturns 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:
getTypein interfaceReindexingRuleProvider- Returns:
- the type identifier (e.g., "inline", "external")
-
getDeletionRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing deletion rules.- Specified by:
getDeletionRulesin interfaceReindexingRuleProvider
-
getDataSchemaRule
@Nullable public ReindexingDataSchemaRule getDataSchemaRule(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns 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:
getDataSchemaRulein interfaceReindexingRuleProvider- 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:
ReindexingDataSchemaRulerule that applies to the given interval.
-
getDataSchemaRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing data schema rules.- Specified by:
getDataSchemaRulesin interfaceReindexingRuleProvider
-
getPartitioningRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing partitioning rules.- Specified by:
getPartitioningRulesin interfaceReindexingRuleProvider
-
getIndexSpecRules
Description copied from interface:ReindexingRuleProviderReturns ALL reindexing index spec rules.- Specified by:
getIndexSpecRulesin interfaceReindexingRuleProvider
-
getDeletionRules
public List<ReindexingDeletionRule> getDeletionRules(org.joda.time.Interval interval, org.joda.time.DateTime referenceTime) Description copied from interface:ReindexingRuleProviderReturns 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:
getDeletionRulesin interfaceReindexingRuleProvider- 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
ReindexingDeletionRulerules 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:ReindexingRuleProviderReturns 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:
getPartitioningRulein interfaceReindexingRuleProvider- 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:
ReindexingPartitioningRulerule 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:ReindexingRuleProviderReturns 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:
getIndexSpecRulein interfaceReindexingRuleProvider- 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
-
hashCode
public int hashCode() -
toString
-