private void junction(int numTerms, int operator) {
    // if any of the operands are junctions with same operator as this one then flatten
    final List<CompiledValue> operands = new ArrayList<>(numTerms);
    for (int i = 0; i < numTerms; i++) {
      final CompiledValue operand = pop();
      // flatten if we can
      if (operand instanceof CompiledJunction
          && ((CompiledJunction) operand).getOperator() == operator) {
        final CompiledJunction junction = (CompiledJunction) operand;
        final List<CompiledValue> jOperands = junction.getOperands();
        operands.addAll(jOperands);
      } else {
        operands.add(operand);
      }
    }

    push(new CompiledJunction(operands.toArray(new CompiledValue[0]), operator));
  }
Creates appropriate CompiledValue for the like predicate based on the sargability of the String
or otherwise. It also works on the last character to see if the sargable like predicate results
in a CompiledJunction or a Comparison. Currently we are supporting only the '%' terminated
"like" predicate.

@param var The CompiledValue representing the variable
@param patternOrBindParam The CompiledLiteral representing the pattern of the like predicate
@return CompiledValue representing the "like" predicate
geode-core/src/main/java/org/apache/geode/cache/query/internal/QCompiler.java