Class FunctionalExtraction
java.lang.Object
org.apache.druid.query.extraction.DimExtractionFn
org.apache.druid.query.extraction.FunctionalExtraction
- All Implemented Interfaces:
Cacheable,ExtractionFn
- Direct Known Subclasses:
LookupExtractionFn
Functional extraction uses a function to find the new value.
null values in the range can either retain the domain's value, or replace the null value with "replaceMissingValueWith"
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.druid.query.extraction.ExtractionFn
ExtractionFn.ExtractionType -
Constructor Summary
ConstructorsConstructorDescriptionFunctionalExtraction(com.google.common.base.Function<String, String> extractionFunction, boolean retainMissingValue, String replaceMissingValueWith, boolean injective) The general constructor which handles most of the logic for extractions which can be expressed as a function of string-->string -
Method Summary
Modifier and TypeMethodDescriptionThe "extraction" function.A dim extraction can be of one of two types, renaming or rebucketing.booleanbooleanbooleanOffers information on whether the extraction will preserve the original ordering of the values.Methods inherited from class org.apache.druid.query.extraction.DimExtractionFn
apply, applyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.druid.java.util.common.Cacheable
getCacheKey
-
Constructor Details
-
FunctionalExtraction
public FunctionalExtraction(com.google.common.base.Function<String, String> extractionFunction, boolean retainMissingValue, String replaceMissingValueWith, boolean injective) The general constructor which handles most of the logic for extractions which can be expressed as a function of string-->string- Parameters:
extractionFunction- The function to call when doing the extraction. The function must be able to accept a null input.retainMissingValue- Boolean value on if functions which result in `null` should use the original value or should be kept as `null`replaceMissingValueWith- String value to replace missing values with (instead of `null`)injective- If this function always has 1:1 renames and the domain has the same cardinality of the input, this should be true and enables optimized query paths.
-
-
Method Details
-
isRetainMissingValue
public boolean isRetainMissingValue() -
getReplaceMissingValueWith
-
isInjective
public boolean isInjective() -
apply
Description copied from interface:ExtractionFnThe "extraction" function. This should map a String value into some other String value.Like
ExtractionFn.apply(Object), the empty string is considered invalid output for this method and it should instead return null.- Parameters:
value- the original value of the dimension- Returns:
- a value that should be used instead of the original
-
preservesOrdering
public boolean preservesOrdering()Description copied from interface:ExtractionFnOffers information on whether the extraction will preserve the original ordering of the values.Some optimizations of queries is possible if ordering is preserved. Null values *do* count towards ordering.
- Returns:
- true if ordering is preserved, false otherwise
-
getExtractionType
Description copied from interface:ExtractionFnA dim extraction can be of one of two types, renaming or rebucketing. In the `ONE_TO_ONE` case, a unique values is modified into another unique value. In the `MANY_TO_ONE` case, there is no longer a 1:1 relation between old dimension value and new dimension value- Returns:
ExtractionFn.ExtractionTypedeclaring what kind of manipulation this function does
-