@Test
  public void testExpression7() throws Exception {
    /* (id < 10 and id < 11 and id < 12) or (id < 13 and id < 14 and id < 15) or
       (id < 16 and id < 17) or id < 18 */
    String exprStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" +
        "<java version=\"1.6.0_31\" class=\"java.beans.XMLDecoder\"> \n" +
        " <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "  <void property=\"children\"> \n" +
        "   <object class=\"java.util.ArrayList\"> \n" +
        "    <void method=\"add\"> \n" +
        "     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "      <void property=\"children\"> \n" +
        "       <object class=\"java.util.ArrayList\"> \n" +
        "        <void method=\"add\"> \n" +
        "         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "          <void property=\"children\"> \n" +
        "           <object class=\"java.util.ArrayList\"> \n" +
        "            <void method=\"add\"> \n" +
        "             <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "              <void property=\"children\"> \n" +
        "               <object class=\"java.util.ArrayList\"> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                  <void property=\"children\"> \n" +
        "                   <object class=\"java.util.ArrayList\"> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                      <void property=\"children\"> \n" +
        "                       <object class=\"java.util.ArrayList\"> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                          <void property=\"column\"> \n" +
        "                           <string>id</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"tabAlias\"> \n" +
        "                           <string>orc_people</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object id=\"PrimitiveTypeInfo0\" class=\"org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo\"> \n" +
        "                            <void property=\"typeName\"> \n" +
        "                             <string>int</string> \n" +
        "                            </void> \n" +
        "                           </object> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                          <void property=\"value\"> \n" +
        "                           <int>10</int> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                       </object> \n" +
        "                      </void> \n" +
        "                      <void property=\"genericUDF\"> \n" +
        "                       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object id=\"PrimitiveTypeInfo1\" class=\"org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo\"> \n" +
        "                        <void property=\"typeName\"> \n" +
        "                         <string>boolean</string> \n" +
        "                        </void> \n" +
        "                       </object> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                      <void property=\"children\"> \n" +
        "                       <object class=\"java.util.ArrayList\"> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                          <void property=\"column\"> \n" +
        "                           <string>id</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"tabAlias\"> \n" +
        "                           <string>orc_people</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                          <void property=\"value\"> \n" +
        "                           <int>11</int> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                       </object> \n" +
        "                      </void> \n" +
        "                      <void property=\"genericUDF\"> \n" +
        "                       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                   </object> \n" +
        "                  </void> \n" +
        "                  <void property=\"genericUDF\"> \n" +
        "                   <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                  <void property=\"children\"> \n" +
        "                   <object class=\"java.util.ArrayList\"> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                      <void property=\"column\"> \n" +
        "                       <string>id</string> \n" +
        "                      </void> \n" +
        "                      <void property=\"tabAlias\"> \n" +
        "                       <string>orc_people</string> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"value\"> \n" +
        "                       <int>12</int> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                   </object> \n" +
        "                  </void> \n" +
        "                  <void property=\"genericUDF\"> \n" +
        "                   <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "               </object> \n" +
        "              </void> \n" +
        "              <void property=\"genericUDF\"> \n" +
        "               <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd\"/> \n" +
        "              </void> \n" +
        "              <void property=\"typeInfo\"> \n" +
        "               <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "              </void> \n" +
        "             </object> \n" +
        "            </void> \n" +
        "            <void method=\"add\"> \n" +
        "             <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "              <void property=\"children\"> \n" +
        "               <object class=\"java.util.ArrayList\"> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                  <void property=\"children\"> \n" +
        "                   <object class=\"java.util.ArrayList\"> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                      <void property=\"children\"> \n" +
        "                       <object class=\"java.util.ArrayList\"> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                          <void property=\"column\"> \n" +
        "                           <string>id</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"tabAlias\"> \n" +
        "                           <string>orc_people</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                          <void property=\"value\"> \n" +
        "                           <int>13</int> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                       </object> \n" +
        "                      </void> \n" +
        "                      <void property=\"genericUDF\"> \n" +
        "                       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                      <void property=\"children\"> \n" +
        "                       <object class=\"java.util.ArrayList\"> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                          <void property=\"column\"> \n" +
        "                           <string>id</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"tabAlias\"> \n" +
        "                           <string>orc_people</string> \n" +
        "                          </void> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                        <void method=\"add\"> \n" +
        "                         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                          <void property=\"typeInfo\"> \n" +
        "                           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                          </void> \n" +
        "                          <void property=\"value\"> \n" +
        "                           <int>14</int> \n" +
        "                          </void> \n" +
        "                         </object> \n" +
        "                        </void> \n" +
        "                       </object> \n" +
        "                      </void> \n" +
        "                      <void property=\"genericUDF\"> \n" +
        "                       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                   </object> \n" +
        "                  </void> \n" +
        "                  <void property=\"genericUDF\"> \n" +
        "                   <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "                  <void property=\"children\"> \n" +
        "                   <object class=\"java.util.ArrayList\"> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                      <void property=\"column\"> \n" +
        "                       <string>id</string> \n" +
        "                      </void> \n" +
        "                      <void property=\"tabAlias\"> \n" +
        "                       <string>orc_people</string> \n" +
        "                      </void> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                    <void method=\"add\"> \n" +
        "                     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                      <void property=\"typeInfo\"> \n" +
        "                       <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                      </void> \n" +
        "                      <void property=\"value\"> \n" +
        "                       <int>15</int> \n" +
        "                      </void> \n" +
        "                     </object> \n" +
        "                    </void> \n" +
        "                   </object> \n" +
        "                  </void> \n" +
        "                  <void property=\"genericUDF\"> \n" +
        "                   <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "               </object> \n" +
        "              </void> \n" +
        "              <void property=\"genericUDF\"> \n" +
        "               <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd\"/> \n" +
        "              </void> \n" +
        "              <void property=\"typeInfo\"> \n" +
        "               <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "              </void> \n" +
        "             </object> \n" +
        "            </void> \n" +
        "           </object> \n" +
        "          </void> \n" +
        "          <void property=\"genericUDF\"> \n" +
        "           <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPOr\"/> \n" +
        "          </void> \n" +
        "          <void property=\"typeInfo\"> \n" +
        "           <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "          </void> \n" +
        "         </object> \n" +
        "        </void> \n" +
        "        <void method=\"add\"> \n" +
        "         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "          <void property=\"children\"> \n" +
        "           <object class=\"java.util.ArrayList\"> \n" +
        "            <void method=\"add\"> \n" +
        "             <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "              <void property=\"children\"> \n" +
        "               <object class=\"java.util.ArrayList\"> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                  <void property=\"column\"> \n" +
        "                   <string>id</string> \n" +
        "                  </void> \n" +
        "                  <void property=\"tabAlias\"> \n" +
        "                   <string>orc_people</string> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"value\"> \n" +
        "                   <int>16</int> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "               </object> \n" +
        "              </void> \n" +
        "              <void property=\"genericUDF\"> \n" +
        "               <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "              </void> \n" +
        "              <void property=\"typeInfo\"> \n" +
        "               <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "              </void> \n" +
        "             </object> \n" +
        "            </void> \n" +
        "            <void method=\"add\"> \n" +
        "             <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "              <void property=\"children\"> \n" +
        "               <object class=\"java.util.ArrayList\"> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "                  <void property=\"column\"> \n" +
        "                   <string>id</string> \n" +
        "                  </void> \n" +
        "                  <void property=\"tabAlias\"> \n" +
        "                   <string>orc_people</string> \n" +
        "                  </void> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "                <void method=\"add\"> \n" +
        "                 <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "                  <void property=\"typeInfo\"> \n" +
        "                   <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "                  </void> \n" +
        "                  <void property=\"value\"> \n" +
        "                   <int>17</int> \n" +
        "                  </void> \n" +
        "                 </object> \n" +
        "                </void> \n" +
        "               </object> \n" +
        "              </void> \n" +
        "              <void property=\"genericUDF\"> \n" +
        "               <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "              </void> \n" +
        "              <void property=\"typeInfo\"> \n" +
        "               <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "              </void> \n" +
        "             </object> \n" +
        "            </void> \n" +
        "           </object> \n" +
        "          </void> \n" +
        "          <void property=\"genericUDF\"> \n" +
        "           <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPAnd\"/> \n" +
        "          </void> \n" +
        "          <void property=\"typeInfo\"> \n" +
        "           <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "          </void> \n" +
        "         </object> \n" +
        "        </void> \n" +
        "       </object> \n" +
        "      </void> \n" +
        "      <void property=\"genericUDF\"> \n" +
        "       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPOr\"/> \n" +
        "      </void> \n" +
        "      <void property=\"typeInfo\"> \n" +
        "       <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "      </void> \n" +
        "     </object> \n" +
        "    </void> \n" +
        "    <void method=\"add\"> \n" +
        "     <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeGenericFuncDesc\"> \n" +
        "      <void property=\"children\"> \n" +
        "       <object class=\"java.util.ArrayList\"> \n" +
        "        <void method=\"add\"> \n" +
        "         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeColumnDesc\"> \n" +
        "          <void property=\"column\"> \n" +
        "           <string>id</string> \n" +
        "          </void> \n" +
        "          <void property=\"tabAlias\"> \n" +
        "           <string>orc_people</string> \n" +
        "          </void> \n" +
        "          <void property=\"typeInfo\"> \n" +
        "           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "          </void> \n" +
        "         </object> \n" +
        "        </void> \n" +
        "        <void method=\"add\"> \n" +
        "         <object class=\"org.apache.hadoop.hive.ql.plan.ExprNodeConstantDesc\"> \n" +
        "          <void property=\"typeInfo\"> \n" +
        "           <object idref=\"PrimitiveTypeInfo0\"/> \n" +
        "          </void> \n" +
        "          <void property=\"value\"> \n" +
        "           <int>18</int> \n" +
        "          </void> \n" +
        "         </object> \n" +
        "        </void> \n" +
        "       </object> \n" +
        "      </void> \n" +
        "      <void property=\"genericUDF\"> \n" +
        "       <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPLessThan\"/> \n" +
        "      </void> \n" +
        "      <void property=\"typeInfo\"> \n" +
        "       <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "      </void> \n" +
        "     </object> \n" +
        "    </void> \n" +
        "   </object> \n" +
        "  </void> \n" +
        "  <void property=\"genericUDF\"> \n" +
        "   <object class=\"org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPOr\"/> \n" +
        "  </void> \n" +
        "  <void property=\"typeInfo\"> \n" +
        "   <object idref=\"PrimitiveTypeInfo1\"/> \n" +
        "  </void> \n" +
        " </object>\n" +
        "</java>";

    ConvertAstToSearchArg.Result result = ConvertAstToSearchArg.createSearchArgument(conf, getFuncDesc(exprStr));
    assertFalse(result.isPartial());
    SearchArgumentImpl sarg =
        (SearchArgumentImpl) result.getSearchArgument();
    List<PredicateLeaf> leaves = sarg.getLeaves();
    assertEquals(9, leaves.size());

    MessageType schema =
        MessageTypeParser.parseMessageType("message test { required int32 id;" +
            " required binary first_name; }");
    Map<String, TypeInfo> columnTypes = new HashMap<>();
    columnTypes.put("id", TypeInfoFactory.getPrimitiveTypeInfo("int"));
    columnTypes.put("first_name", TypeInfoFactory.getPrimitiveTypeInfo("string"));

    FilterPredicate p = ParquetFilterPredicateConverter.toFilterPredicate(sarg, schema, columnTypes);
    String expected = "and(and(and(and(and(and(and(and(and(and(and(and(and(and(and(and(and(" +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 13)), lt(id, 16)), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 13)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 13)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 14)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 14)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 14)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 15)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 15)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 15)), lt(id, 16))), " +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 13)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 13)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 13)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 14)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 14)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 14)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 10)), lt(id, 15)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 11)), lt(id, 15)), lt(id, 17))), " +
      "or(or(or(lt(id, 18), lt(id, 12)), lt(id, 15)), lt(id, 17)))";
    assertEquals(p.toString(), expected);

    PredicateLeaf leaf = leaves.get(0);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(18L, leaf.getLiteral());

    leaf = leaves.get(1);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(10L, leaf.getLiteral());

    leaf = leaves.get(2);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(13L, leaf.getLiteral());

    leaf = leaves.get(3);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(16L, leaf.getLiteral());

    leaf = leaves.get(4);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(11L, leaf.getLiteral());

    leaf = leaves.get(5);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(12L, leaf.getLiteral());

    leaf = leaves.get(6);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(14L, leaf.getLiteral());

    leaf = leaves.get(7);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(15L, leaf.getLiteral());

    leaf = leaves.get(8);
    assertEquals(PredicateLeaf.Type.LONG, leaf.getType());
    assertEquals(PredicateLeaf.Operator.LESS_THAN, leaf.getOperator());
    assertEquals("id", leaf.getColumnName());
    assertEquals(17L, leaf.getLiteral());

    assertEquals("(and" +
        " (or leaf-0 leaf-1 leaf-2 leaf-3)" +
        " (or leaf-0 leaf-4 leaf-2 leaf-3)" +
        " (or leaf-0 leaf-5 leaf-2 leaf-3)" +
        " (or leaf-0 leaf-1 leaf-6 leaf-3)" +
        " (or leaf-0 leaf-4 leaf-6 leaf-3)" +
        " (or leaf-0 leaf-5 leaf-6 leaf-3)" +
        " (or leaf-0 leaf-1 leaf-7 leaf-3)" +
        " (or leaf-0 leaf-4 leaf-7 leaf-3)" +
        " (or leaf-0 leaf-5 leaf-7 leaf-3)" +
        " (or leaf-0 leaf-1 leaf-2 leaf-8)" +
        " (or leaf-0 leaf-4 leaf-2 leaf-8)" +
        " (or leaf-0 leaf-5 leaf-2 leaf-8)" +
        " (or leaf-0 leaf-1 leaf-6 leaf-8)" +
        " (or leaf-0 leaf-4 leaf-6 leaf-8)" +
        " (or leaf-0 leaf-5 leaf-6 leaf-8)" +
        " (or leaf-0 leaf-1 leaf-7 leaf-8)" +
        " (or leaf-0 leaf-4 leaf-7 leaf-8)" +
        " (or leaf-0 leaf-5 leaf-7 leaf-8))",
        sarg.getExpression().toOldString());
  }
These tests cover the conversion from Hive's AST to SearchArguments.
ql/src/test/org/apache/hadoop/hive/ql/io/sarg/TestConvertAstToSearchArg.java