Class BucketExtractionFn
- java.lang.Object
-
- org.apache.druid.query.extraction.BucketExtractionFn
-
- All Implemented Interfaces:
Cacheable
,ExtractionFn
public class BucketExtractionFn extends Object implements ExtractionFn
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.druid.query.extraction.ExtractionFn
ExtractionFn.ExtractionType
-
-
Constructor Summary
Constructors Constructor Description BucketExtractionFn(Double size, Double offset)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
apply(long value)
The "extraction" function.String
apply(Object value)
The "extraction" function.String
apply(String value)
The "extraction" function.boolean
equals(Object o)
byte[]
getCacheKey()
Get a byte array used as a cache key.ExtractionFn.ExtractionType
getExtractionType()
A dim extraction can be of one of two types, renaming or rebucketing.double
getOffset()
double
getSize()
int
hashCode()
boolean
preservesOrdering()
Offers information on whether the extraction will preserve the original ordering of the values.String
toString()
-
-
-
Method Detail
-
getSize
public double getSize()
-
getOffset
public double getOffset()
-
apply
@Nullable public String apply(@Nullable Object value)
Description copied from interface:ExtractionFn
The "extraction" function. This should map an Object into some String value.In order to maintain the "null and empty string are equivalent" semantics that Druid provides, the empty string is considered invalid output for this method and should instead return null. This is a contract on the method rather than enforced at a lower level in order to eliminate a global check for extraction functions that do not already need one.
- Specified by:
apply
in interfaceExtractionFn
- Parameters:
value
- the original value of the dimension- Returns:
- a value that should be used instead of the original
-
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.- Specified by:
apply
in interfaceExtractionFn
- Parameters:
value
- the original value of the dimension- Returns:
- a value that should be used instead of the original
-
apply
public String apply(long value)
Description copied from interface:ExtractionFn
The "extraction" function. This should map a long value into some String value.Like
ExtractionFn.apply(Object)
, the empty string is considered invalid output for this method and it should instead return null.- Specified by:
apply
in interfaceExtractionFn
- 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.
- Specified by:
preservesOrdering
in interfaceExtractionFn
- 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- Specified by:
getExtractionType
in interfaceExtractionFn
- Returns:
ExtractionFn.ExtractionType
declaring what kind of manipulation this function does
-
getCacheKey
public byte[] getCacheKey()
Description copied from interface:Cacheable
Get a byte array used as a cache key.- Specified by:
getCacheKey
in interfaceCacheable
- Returns:
- a cache key
-
-