Class MapLookupExtractor
java.lang.Object
org.apache.druid.query.lookup.LookupExtractor
org.apache.druid.query.extraction.MapLookupExtractor
Lookup extractor backed by any kind of map.
When the map is immutable, use
ImmutableLookupMap instead.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionApply a particular lookup methodology to the input stringasMap()Returns a Map view of this lookup extractor.booleanlongEstimated heap footprint of this object.static <K,V> long estimateHeapFootprint(Iterable<Map.Entry<K, V>> entries) Estimate the heap footprint of a Map.byte[]Create a cache key for use in results cachinggetMap()inthashCode()booleanbooleanReturns whether this lookup extractor'sLookupExtractor.asMap()will return a valid map.Reverse lookup from a given value.unapplyAll(Set<String> values) Reverse lookup from a given set of values.Methods inherited from class org.apache.druid.query.lookup.LookupExtractor
applyAll
-
Constructor Details
-
MapLookupExtractor
-
-
Method Details
-
estimateHeapFootprint
Estimate the heap footprint of a Map. Important note: the implementation accepts any kind of map entries, but estimates zero footprint for keys and values of types other than String. -
getMap
-
apply
Description copied from class:LookupExtractorApply a particular lookup methodology to the input string- Specified by:
applyin classLookupExtractor- Parameters:
key- The value to apply the lookup to.- Returns:
- The value for this key, or null when key is `null` or when key cannot have the lookup applied to it and should be treated as missing.
-
unapply
Description copied from class:LookupExtractorReverse lookup from a given value. Used by the default implementation ofLookupExtractor.unapplyAll(Set). Otherwise unused. Implementations that overrideLookupExtractor.unapplyAll(Set)may throwUnsupportedOperationExceptionfrom this method.- Specified by:
unapplyin classLookupExtractor- Parameters:
value- the value to apply the reverse lookup.- Returns:
- the list of keys that maps to the provided value. In SQL-compatible null handling mode, null keys are omitted.
-
unapplyAll
Description copied from class:LookupExtractorReverse lookup from a given set of values.- Overrides:
unapplyAllin classLookupExtractor- Parameters:
values- set of values to reverse lookup.- Returns:
- iterator of keys that map to to the provided set of values. May contain duplicate keys. Returns null if this lookup instance does not support reverse lookups. In SQL-compatible null handling mode, null keys are omitted.
-
isOneToOne
public boolean isOneToOne()- Overrides:
isOneToOnein classLookupExtractor
-
getCacheKey
public byte[] getCacheKey()Description copied from class:LookupExtractorCreate a cache key for use in results caching- Specified by:
getCacheKeyin classLookupExtractor- Returns:
- A byte array that can be used to uniquely identify if results of a prior lookup can use the cached values
-
supportsAsMap
public boolean supportsAsMap()Description copied from class:LookupExtractorReturns whether this lookup extractor'sLookupExtractor.asMap()will return a valid map.- Specified by:
supportsAsMapin classLookupExtractor
-
asMap
Description copied from class:LookupExtractorReturns a Map view of this lookup extractor. The map may change along with the underlying lookup data.- Specified by:
asMapin classLookupExtractor
-
estimateHeapFootprint
public long estimateHeapFootprint()Description copied from class:LookupExtractorEstimated heap footprint of this object. Not guaranteed to be accurate. For example, some implementations return zero even though they do use on-heap structures. However, the most common classes,MapLookupExtractorandImmutableLookupMap, do have reasonable implementations. This API is provided for best-effort memory management and monitoring.- Overrides:
estimateHeapFootprintin classLookupExtractor
-
equals
-
hashCode
public int hashCode()
-