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 @@ -158,6 +158,9 @@ private Predicate convertLeaf(PredicateLeaf leaf) {
.collect(Collectors.toList()));
case BETWEEN:
List<Object> literalList = leaf.getLiteralList();
if (literalList == null || literalList.size() < 2) {
throw new UnsupportedOperationException("BETWEEN literals are not available.");
}
return builder.between(
idx,
toLiteral(columnType, literalList.get(0)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import org.apache.hadoop.hive.ql.io.sarg.PredicateLeaf;
import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory;
import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentImpl.PredicateLeafImpl;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -258,6 +259,28 @@ public void testBetween() {
assertExpected(sarg, expected);
}

@Test
public void testUnavailableBetween() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
SearchArgument sarg =
builder.startAnd()
.between("f_bigint", PredicateLeaf.Type.LONG, 100L, 200L)
.lessThanEquals("f_int", PredicateLeaf.Type.LONG, 10L)
.end()
.build();
sarg.getLeaves()
.set(
0,
new PredicateLeafImpl(
PredicateLeaf.Operator.BETWEEN,
PredicateLeaf.Type.LONG,
"f_bigint",
null,
Collections.emptyList()));

assertExpected(sarg, BUILDER.lessOrEqual(0, 10));
}

@Test
public void testNotBetween() {
SearchArgument.Builder builder = SearchArgumentFactory.newBuilder();
Expand Down
Loading