public static HiveProject createProjectWithoutColumn(RelNode input, Set<Integer> positions)
      throws CalciteSemanticException {
    List<RexNode> originalInputRefs = Lists.transform(input.getRowType().getFieldList(),
        new Function<RelDataTypeField, RexNode>() {
          @Override
          public RexNode apply(RelDataTypeField input) {
            return new RexInputRef(input.getIndex(), input.getType());
          }
        });
    List<RexNode> copyInputRefs = new ArrayList<>();
    for (int i = 0; i < originalInputRefs.size(); i++) {
      if (!positions.contains(i)) {
        copyInputRefs.add(originalInputRefs.get(i));
      }
    }
    return HiveProject.create(input, copyInputRefs, null);
  }
Check if the expression is usable for query materialization, returning the first failing expression.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveCalciteUtil.java