public static List<RexNode> rewriteCoalesceChildren(
      List<RexNode> childRexNodeLst, RexBuilder rexBuilder) {
    final List<RexNode> convertedChildList = Lists.newArrayList();
    assert childRexNodeLst.size() > 0;
    int i=0;
    for (; i < childRexNodeLst.size()-1; ++i) {
      // WHEN child not null THEN child
      final RexNode child = childRexNodeLst.get(i);
      RexNode childCond = rexBuilder.makeCall(
          SqlStdOperatorTable.IS_NOT_NULL, child);
      convertedChildList.add(childCond);
      convertedChildList.add(child);
    }
    // Add the last child as the ELSE element
    convertedChildList.add(childRexNodeLst.get(i));
    return convertedChildList;
  }
The method tries to rewrite an the operands of an IN function call into
the operands for an OR function call.
For instance:
<pre>
(c) IN ( v1, v2, ...) =&gt; c=v1 || c=v2 || ...
Input: (c, v1, v2, ...)
Output: (c=v1, c=v2, ...)
</pre>
Or:
<pre>
(c,d) IN ( (v1,v2), (v3,v4), ...) =&gt; (c=v1 &amp;&amp; d=v2) || (c=v3 &amp;&amp; d=v4) || ...
Input: ((c,d), (v1,v2), (v3,v4), ...)
Output: (c=v1 &amp;&amp; d=v2, c=v3 &amp;&amp; d=v4, ...)
</pre>

Returns null if the transformation fails, e.g., when non-deterministic
calls are found in the expressions.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/translator/RexNodeConverter.java