Skip to content

Commit

Permalink
Add isNotNull to Domain
Browse files Browse the repository at this point in the history
Convenience method for domain.getValues().isAll() && !domain.isNullAllowed().
This translates to IS NOT NULL.
  • Loading branch information
elonazoulay committed May 21, 2023
1 parent 150d340 commit cb09b22
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public boolean isOnlyNull()
return values.isNone() && nullAllowed;
}

public boolean isNotNull()
{
return values.isAll() && !nullAllowed;
}

public Object getSingleValue()
{
if (!isSingleValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ else if (domain.isOnlyNull()) {
else if (!domain.getValues().isNone() && domain.isNullAllowed()) {
// no restriction
}
else if (domain.getValues().isAll() && !domain.isNullAllowed()) {
else if (domain.isNotNull()) {
builder.addPredicate(KuduPredicate.newIsNotNullPredicate(columnSchema));
}
else if (domain.isSingleValue()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ private static Optional<Document> buildPredicate(MongoColumnHandle column, Domai
if (domain.getValues().isNone() && domain.isNullAllowed()) {
return Optional.of(documentOf(name, isNullPredicate()));
}
if (domain.getValues().isAll() && !domain.isNullAllowed()) {
if (domain.isNotNull()) {
return Optional.of(documentOf(name, isNotNullPredicate()));
}

Expand Down

0 comments on commit cb09b22

Please sign in to comment.