Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static <T> UnboundPredicate<T> predicate(Operation op, String name, Liter
&& op != Operation.NOT_NULL
&& op != Operation.IS_NAN
&& op != Operation.NOT_NAN,
"Cannot create %s predicate inclusive a value",
"Cannot create %s predicate with a value",
op);
Preconditions.checkArgument(
!NaNUtil.isNaN(lit.value()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.iceberg.expressions;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;

Expand Down Expand Up @@ -1452,6 +1453,13 @@ public void testSanitizeVariantObject() {
ExpressionUtil.sanitize(bound));
}

@Test
public void testPredicateWithValueForUnaryOperation() {
assertThatThrownBy(() -> Expressions.predicate(Expression.Operation.IS_NULL, "x", 5))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Cannot create IS_NULL predicate with a value");
}

private static VariantPrimitive<?> createTimestampNanos(int primitiveHeader) {
return VariantTestUtil.createSerializedPrimitive(
primitiveHeader,
Expand Down