Class FunctionalExtraction

  • All Implemented Interfaces:
    Cacheable, ExtractionFn
    Direct Known Subclasses:
    LookupExtractionFn

    public abstract class FunctionalExtraction
    extends DimExtractionFn
    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"
    • Constructor Detail

      • 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 Detail

      • isRetainMissingValue

        public boolean isRetainMissingValue()
      • getReplaceMissingValueWith

        public String getReplaceMissingValueWith()
      • isInjective

        public boolean isInjective()
      • apply

        @Nullable
        public String apply​(@Nullable
                            String value)
        Description copied from interface: ExtractionFn
        The "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: ExtractionFn
        Offers 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

        public ExtractionFn.ExtractionType getExtractionType()
        Description copied from interface: ExtractionFn
        A 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.ExtractionType declaring what kind of manipulation this function does