Skip to content

missing value handling on LookupExtractionFn, Fix for #2775#2785

Closed
b-slim wants to merge 1 commit intoapache:masterfrom
b-slim:fix_issue_2775
Closed

missing value handling on LookupExtractionFn, Fix for #2775#2785
b-slim wants to merge 1 commit intoapache:masterfrom
b-slim:fix_issue_2775

Conversation

@b-slim
Copy link
Copy Markdown
Contributor

@b-slim b-slim commented Apr 4, 2016

Fix for Issue #2775
fix optimize when we have ReplaceMissingValueWith or retainMissingValue. Correct path is to push down the filter if we have retainMissingValue or ReplaceMissingValueWith is matching with the value.

@b-slim b-slim added the Bug label Apr 4, 2016
@b-slim b-slim added this to the 0.9.0 milestone Apr 4, 2016
@b-slim
Copy link
Copy Markdown
Contributor Author

b-slim commented Apr 4, 2016

@jon-wei checkout this.

@fjy fjy closed this Apr 4, 2016
@fjy fjy reopened this Apr 4, 2016
LookupExtractor lookup = ((LookupExtractionFn) this.getExtractionFn()).getLookup();
// case ReplaceMissingValueWith matching the value we can not optimize
final LookupExtractionFn lookupExtractionFn = (LookupExtractionFn) this.getExtractionFn();
if (Strings.emptyToNull(lookupExtractionFn.getReplaceMissingValueWith()) == Strings.emptyToNull(value)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine to leave out the emptyToNull() call on Strings.emptyToNull(lookupExtractionFn.getReplaceMissingValueWith(), since the constructor of FunctionalExtraction already does that:

  public FunctionalExtraction(
      final Function<String, String> extractionFunction,
      final boolean retainMissingValue,
      final String replaceMissingValueWith,
      final boolean injective
  )
  {
    this.retainMissingValue = retainMissingValue;
    this.replaceMissingValueWith = Strings.emptyToNull(replaceMissingValueWith);

@jon-wei
Copy link
Copy Markdown
Contributor

jon-wei commented Apr 4, 2016

@b-slim I've made essentially the same fix in this PR:

https://github.com/jon-wei/druid/blob/filter_support/processing/src/main/java/io/druid/query/filter/SelectorDimFilter.java#L77

Can we use this implementation, if you plan on backporting this to 0.9.0?

@b-slim
Copy link
Copy Markdown
Contributor Author

b-slim commented Apr 4, 2016

@jon-wei both implems lead to the same path, if you prefer your way i am ok, have you already sent the PR ? or sham i update this ?

@jon-wei
Copy link
Copy Markdown
Contributor

jon-wei commented Apr 4, 2016

I have the fix in this PR, which seems like it's close to being merged:

#2690

I can do the backport 0.9.0 if you'd like.

@b-slim
Copy link
Copy Markdown
Contributor Author

b-slim commented Apr 4, 2016

@jon-wei OK. Will be fixed by #2690

@b-slim b-slim closed this Apr 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants