Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UT and documentation to the extraction filter #1578

Merged
merged 7 commits into from
Sep 1, 2015

Conversation

b-slim
Copy link
Contributor

@b-slim b-slim commented Jul 30, 2015

This PR has several fix and unit test for extraction filter:

  • Fix extractionFilter by implementing both make matcher in ExtractionFilter
  • Fix getBitmapIndex to consider the case dim is null
  • Unit Test for exractionFn with empty result and null_column
  • UT for TopN queries with Extraction filter
  • Fix to make sure that empty string are converted to null

@himanshug
Copy link
Contributor

closing/reopening for rebuild

@himanshug himanshug closed this Jul 30, 2015
@himanshug himanshug reopened this Jul 30, 2015
if (allDimVals != null) {
for (int i = 0; i < allDimVals.size(); i++) {
if (allDimVals != null)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

old code looked ok, I think druid codebase style is to keep parenthesis on the same line except for class/method opening.

@xvrl
Copy link
Member

xvrl commented Jul 31, 2015

@b-slim your PR description mentions "Unit Test for exractionFn with empty result", however, if I understand correctly this would be a violation of the ExtractionFn contract, which explicitly states that an ExtractionFn should always return null, and never return empty string. Maybe I am missing something?

throw new UnsupportedOperationException();
final DimensionSelector dimensionSelector = columnSelectorFactory.makeDimensionSelector(dimension, null);
if (dimensionSelector == null) {
return new BooleanValueMatcher(Strings.isNullOrEmpty(fn.apply(value)));
Copy link
Contributor

Choose a reason for hiding this comment

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

if a column was missing, should we ever match it in this case? fn.apply(value) looks a little bit unusual as value is really an element from the Range of the function and not Domain. may be it should be...

return new BooleanValueMatcher(false);

@xvrl ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i am not sure when dimensionSelector == null but following the same logic in other filter it should be return new BooleanValueMatcher(value.equals(fn.apply(null))) i guess.

@b-slim
Copy link
Contributor Author

b-slim commented Jul 31, 2015

@xvrl i have updated the test name, it is true that empty result is confusing

Slim Bouguerra added 3 commits August 3, 2015 09:02
Fix getBitmapIndex to consider the case were dim is null
Unit Test for exractionFn with empty result and null_column
UT for TopN queries with Extraction filter
refactor in Extractiuon fileter makematcher for realtime segment and clean code in b/processing/src/test/java/io/druid/query/groupby/GroupByQueryRunnerTest.java
fix to make sure that empty string are converted to null
"product_3": "bar_1"
}
},
"replaceMissingValueWith": "",
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these 3 properties required? I think the example would be a bit easier to digest with an initial example showing the minimum required set and then an extra explanation/example showing the optional parameters as well.

@b-slim
Copy link
Contributor Author

b-slim commented Aug 4, 2015

@cheddar please kindly check the new changes

@fjy fjy added this to the 0.8.2 milestone Aug 13, 2015
@b-slim
Copy link
Contributor Author

b-slim commented Aug 17, 2015

@cheddar i have added the null case handling,
@xvrl i saw that the null check is your code, any reason to don't allow null value for extraction filters?

@xvrl
Copy link
Member

xvrl commented Aug 17, 2015

@b-slim can you point to me which check you're talking about?

@xvrl
Copy link
Member

xvrl commented Aug 25, 2015

@b-slim I may have blindly added that check out of habit, I think we should allow nulls in the extractiondimfilter

@b-slim
Copy link
Contributor Author

b-slim commented Aug 26, 2015

@xvrl thanks for looking, can you please review the overall contribution please ?

@fjy
Copy link
Contributor

fjy commented Aug 30, 2015

@b-slim @cheddar @xvrl Can we finish this one off?

@b-slim
Copy link
Contributor Author

b-slim commented Aug 31, 2015

I think i have addressed all the comments

@fjy
Copy link
Contributor

fjy commented Sep 1, 2015

👍

cheddar added a commit that referenced this pull request Sep 1, 2015
Fix UT and documentation to the extraction filter
@cheddar cheddar merged commit 4f61b42 into apache:master Sep 1, 2015
@xvrl
Copy link
Member

xvrl commented Sep 1, 2015

@cheddar @b-slim please remember to squash before merging

@xvrl
Copy link
Member

xvrl commented Sep 1, 2015

otherwise it makes it hard to backport fixes, cherry-pick, or investigate regressions, because of the way commits are ordered.

@drcrallen
Copy link
Contributor

Now would be a nice time to be able to backport this. It can easily cause QTL to break for peons if they do not have values for the extracted dimension yet.

seoeun25 pushed a commit to seoeun25/incubator-druid that referenced this pull request Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants