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

PARQUET-34: Extend Contains support to all ColumnFilterPredicate types #1370

Merged
merged 2 commits into from
Jun 14, 2024

Conversation

clairemcginty
Copy link
Contributor

Follows up on this discussion from #1328 to fast-follow by expanding Contains predicate support from only Eq<T> to all ColumnFilterPredicate<T> types.

Jira

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference Jira issues in their subject lines. In addition, my commits follow the guidelines
    from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Style

  • My contribution adheres to the code style guidelines and Spotless passes.
    • To apply the necessary changes, run mvn spotless:apply -Pvector-plugins

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • All the public functions and the classes in the PR contain Javadoc that explain what it does

add(" set = true;\n");

add(" break;\n");
add(" setResult(true);\n return;\n");
Copy link
Contributor Author

@clairemcginty clairemcginty Jun 4, 2024

Choose a reason for hiding this comment

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

I simplified the existing ValueInspector logic a bit for In/NotIn here. Previously it was:

  @Override
  public void update(int value) {
	boolean set = false;
	for (int i : target) {
	  if(comparator.compare(value, i) != 0) {
		 setResult(true);
		 set = true;
		 break;
	   }
	 }
	 if (!set) setResult(false);
   }
 };
}

Now it's:

@Override
public void update(int value) {
for (int i : target) {
  if(comparator.compare(value, i) == 0 ) {
	 setResult(true);
	 return;
   }
 }
 setResult(false);
}

Copy link
Member

@wgtmac wgtmac left a comment

Choose a reason for hiding this comment

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

+1

Sorry for the delay. cc @gszadovszky

Copy link
Contributor

@gszadovszky gszadovszky left a comment

Choose a reason for hiding this comment

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

Looks good to me! I have just one nit comment.

Comment on lines 430 to 433
|| underlying instanceof SetColumnFilterPredicate
&& ((SetColumnFilterPredicate) underlying)
.getValues()
.contains(null)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I know it means the same logically, but I think it is more readable to wrap in a parenthesis since the instanceof and the related cast are tightly related.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense! updated

@gszadovszky gszadovszky merged commit 9275d59 into apache:master Jun 14, 2024
9 checks passed
@wgtmac wgtmac added this to the 1.15.0 milestone Sep 30, 2024
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.

3 participants