private VectorExpression getCastToBooleanExpression(List<ExprNodeDesc> childExpr, VectorExpressionDescriptor.Mode mode)
      throws HiveException {
    ExprNodeDesc child = childExpr.get(0);
    TypeInfo inputTypeInfo = child.getTypeInfo();
    String inputType = inputTypeInfo.toString();
    if (child instanceof ExprNodeConstantDesc) {
      if (null == ((ExprNodeConstantDesc)child).getValue()) {
        return getConstantVectorExpression(null, TypeInfoFactory.booleanTypeInfo, mode);
      }
      // Don't do constant folding here.  Wait until the optimizer is changed to do it.
      // Family of related JIRAs: HIVE-7421, HIVE-7422, and HIVE-7424.
      return null;
    }

    VectorExpression ve;
    // Long and double are handled using descriptors, string needs to be specially handled.
    if (isStringFamily(inputType)) {
      ve = createVectorExpression(CastStringToBoolean.class, childExpr,
          VectorExpressionDescriptor.Mode.PROJECTION, TypeInfoFactory.booleanTypeInfo, DataTypePhysicalVariation.NONE);
    } else {
      // Ok, try the UDF.
      ve = getVectorExpressionForUdf(null, UDFToBoolean.class, childExpr,
          VectorExpressionDescriptor.Mode.PROJECTION, TypeInfoFactory.booleanTypeInfo);
    }

    if (ve == null || mode == VectorExpressionDescriptor.Mode.PROJECTION) {
      return ve;
    }

    int outputColumnNum = ve.getOutputColumnNum();
    SelectColumnIsTrue filterVectorExpr = new SelectColumnIsTrue(outputColumnNum);
    filterVectorExpr.setChildExpressions(new VectorExpression[] { ve });
    filterVectorExpr.setInputTypeInfos(ve.getOutputTypeInfo());
    filterVectorExpr.setInputDataTypePhysicalVariations(DataTypePhysicalVariation.NONE);
    return filterVectorExpr;
  }
Invoke special handling for expressions that can't be vectorized by regular
descriptor based lookup.
ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorizationContext.java