Skip to content

Commit

Permalink
Validate assumptions in GlueExpressionUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi authored and ebyhr committed Jul 20, 2022
1 parent f01510d commit 305c486
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import java.util.Set;

import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Verify.verify;
import static com.google.common.collect.Iterables.getOnlyElement;
import static java.lang.String.format;
import static java.util.Locale.ENGLISH;
Expand Down Expand Up @@ -156,11 +157,13 @@ static Optional<String> buildGlueExpressionForSingleDomain(String columnName, Do
}

if (domain.getValues().isAll()) {
verify(!domain.isNullAllowed(), "Unexpected domain: %s", domain);
return Optional.of(format("(%s <> '%s')", columnName, NULL_STRING));
}

// null must be allowed for this case since callers must filter Domain.none() out
if (domain.getValues().isNone()) {
// null must be allowed for this case since callers must filter Domain.none() out
verify(domain.isNullAllowed(), "Unexpected domain: %s", domain);
return Optional.of(format("(%s = '%s')", columnName, NULL_STRING));
}

Expand Down

0 comments on commit 305c486

Please sign in to comment.