code: private static void generateAllCombinations(
        List<Filter> result,
        List<Filter> andList,
        List<Filter> nonAndList
    )
    {
      List<Filter> children = ((AndFilter) andList.get(0)).getFilters();
      if (result.isEmpty()) {
        for (Filter child : children) {
          List<Filter> a = Lists.newArrayList(nonAndList);
          a.add(child);
          result.add(new OrFilter(a));
        }
      } else {
        List<Filter> work = new ArrayList<>(result);
        result.clear();
        for (Filter child : children) {
          for (Filter or : work) {
            List<Filter> a = Lists.newArrayList((((OrFilter) or).getFilters()));
            a.add(child);
            result.add(new OrFilter(a));
          }
        }
      }
      if (andList.size() > 1) {
        generateAllCombinations(result, andList.subList(1, andList.size()), nonAndList);
      }
    }
docs: https://github.com/apache/hive/blob/branch-2.0/storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java