@Test public void computeOptimizedScanPartitionOrAndCombinedFilter() {
    KafkaScanTrimmer kafkaScanTrimmer = new KafkaScanTrimmer(fullHouse, null);

    // partition = 1 or (partition >2 and <= 3)
    ExprNodeGenericFuncDesc eq = eq(Lists.newArrayList(partitionColumn, ConstantExprBuilder.build(1)));
    ExprNodeGenericFuncDesc lessEq = lessThanEq(Lists.newArrayList(partitionColumn, ConstantExprBuilder.build(3)));
    ExprNodeGenericFuncDesc greater = greaterThan(Lists.newArrayList(partitionColumn, ConstantExprBuilder.build(2)));
    ExprNodeGenericFuncDesc orNode = or(Lists.newArrayList(and(Lists.newArrayList(lessEq, greater)), eq));

    Map
        actual =
        kafkaScanTrimmer.computeOptimizedScan(SerializationUtilities
            .deserializeExpression(SerializationUtilities.serializeExpression(orNode)));
    Map
        expected =
        Maps.filterValues(fullHouse, tp -> Objects.requireNonNull(tp).getPartition() == 1 || tp.getPartition() == 3);
    Assert.assertEquals(expected, actual);
    assertNotNull(orNode);
  }
Test Class for Kafka Trimmer Class.
kafka-handler/src/test/org/apache/hadoop/hive/kafka/KafkaScanTrimmerTest.java