nozjkoitop commented on code in PR #19548:
URL: https://github.com/apache/druid/pull/19548#discussion_r3490445484
##########
processing/src/main/java/org/apache/druid/query/dimension/LookupDimensionSpec.java:
##########
@@ -136,18 +139,51 @@ public String getName()
@Override
public ExtractionFn getExtractionFn()
{
- final LookupExtractor lookupExtractor;
+ final LookupExtractor lookupExtractor = getLookupExtractor();
+ return makeLookupExtractionFn(lookupExtractor);
+ }
+
+ @Override
+ public ExtractionFn getExtractionFnForMetadata()
+ {
+ return makeLookupExtractionFn(getLookupExtractorForMetadata());
+ }
+
+ private LookupExtractor getLookupExtractor()
+ {
+ if (Strings.isNullOrEmpty(name)) {
+ return this.lookup;
+ }
+
+ final LookupExtractorFactory lookupExtractorFactory =
getLookupExtractorFactory();
+ final Optional<RetainedLookupExtractor> retainedLookupExtractor =
+ lookupExtractorFactory.acquireRetainedLookupExtractor();
+
+ // ExtractionFn has no close hook. The RetainedLookupExtractor cleaner
releases this reference when the
+ // LookupExtractionFn that owns it becomes unreachable.
+ return retainedLookupExtractor.<LookupExtractor>map(retained ->
retained).orElseGet(lookupExtractorFactory);
Review Comment:
fair, updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]