-
Notifications
You must be signed in to change notification settings - Fork 2.5k
[HUDI-3739] Fix handling of the isNotNull predicate in Data Skipping
#5224
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
Conversation
isNotNull predicate in Data SkippingisNotNull predicate in Data Skipping
| private val COLUMN_STATS_INDEX_MIN_VALUE_STAT_NAME = "minValue" | ||
| private val COLUMN_STATS_INDEX_MAX_VALUE_STAT_NAME = "maxValue" | ||
| private val COLUMN_STATS_INDEX_NUM_NULLS_STAT_NAME = "num_nulls" | ||
| private val COLUMN_STATS_INDEX_NULL_COUNT_STAT_NAME = "nullCount" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we not reuse HoodieMetadataPayload.* constants here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call. This was copied over from a legacy component w/o much afterthought. Addressed
| case IsNotNull(attribute: AttributeReference) => | ||
| getTargetIndexedColumnName(attribute, indexSchema) | ||
| .map(colName => EqualTo(genColNumNullsExpr(colName), Literal(0))) | ||
| .map(colName => LessThan(genColNumNullsExpr(colName), genColValueCountExpr)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filter colA is not null is the complement to colA is null then why the two have different translation (one has to depend on the valueCount while the other depends on Literal(0))?
I mean if colA is null is translated to GreaterThan(genColNumNullsExpr(colName), Literal(0)), then shouldn't colA is not null be translated to LessThanOrEqual(genColNumNullsExpr(colName), Literal(0))?
Or if you say that colA is not null should be translated to LessThan(genColNumNullsExpr(colName), genColValueCountExpr), then shouldn't colA is null be translated to GreaterThanOrEqual(genColNumNullsExpr(colName), genColValueCountExpr)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ha! Great question.
The reason is logical fallacy: "colA is not null" != "there is no null in colA", instead it's "colA contains non-null" (you can check out some other expressions, there are many expressions in this list that carry such properties):
- "is null" means that the column has to contain null values (ie
nullCount> 0) - "is not null" means that the column has to contain non-null values (ie
nullCount<valueCount)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
got it. makes sense then.
f054124 to
6cabaa7
Compare
codope
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Can land once the CI is green.
Updated fixtures;
6cabaa7 to
4075e19
Compare
isNotNull predicate in Data SkippingisNotNull predicate in Data Skipping
#5224) - Fix handling of the isNotNull predicate in Data Skipping
Tips
What is the purpose of the pull request
Fix handling of the
isNotNullpredicate in Data SkippingBrief change log
isNotNullpredicate in Data SkippingVerify this pull request
This change added tests and can be verified as follows:
Committer checklist
Has a corresponding JIRA in PR title & commit
Commit message is descriptive of the change
CI is green
Necessary doc changes done or have another open PR
For large changes, please consider breaking it into sub-tasks under an umbrella JIRA.