private ExprNodeDesc generateFilterTagMask(byte tag, ExprNodeDesc condition) {
    ExprNodeDesc filterMaskValue = new ExprNodeConstantDesc(shortType, (short) (1 << tag));

    List<ExprNodeDesc> negateArg = Collections.singletonList(condition);
    ExprNodeDesc negate = new ExprNodeGenericFuncDesc(
        TypeInfoFactory.getPrimitiveTypeInfo(serdeConstants.BOOLEAN_TYPE_NAME),
        new GenericUDFOPNot(),
        negateArg);

    GenericUDFBridge toShort = new GenericUDFBridge();
    toShort.setUdfClassName(UDFToShort.class.getName());
    toShort.setUdfName(UDFToShort.class.getSimpleName());

    List<ExprNodeDesc> toShortArg = Collections.singletonList(negate);
    ExprNodeDesc conditionAsShort = new ExprNodeGenericFuncDesc(shortType, toShort, toShortArg);

    List<ExprNodeDesc> multiplyArgs = Arrays.asList(conditionAsShort, filterMaskValue);
    ExprNodeDesc multiply = new ExprNodeGenericFuncDesc(shortType, new GenericUDFOPMultiply(), multiplyArgs);

    return multiply;
  }
Generate an ExprNodeDesc that expresses the following code:
  UDFToShort(!condition) * (short) (1 << tag),
which is logically equivalent to
  if (condition) { return (short) 0 } else { return (short) (1 << tag); }.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/FiltertagAppenderProc.java