private Pair<RelNode, RowResolver> genConstraintFilterLogicalPlan(
        QB qb, Pair<RelNode, RowResolver> selPair, ImmutableMap<String, Integer> outerNameToPosMap, RowResolver outerRR)
        throws SemanticException {
      if (qb.getIsQuery()) {
        return null;
      }

      String dest = qb.getParseInfo().getClauseNames().iterator().next();
      if (!updating(dest)) {
        return null;
      }

      RowResolver inputRR = relToHiveRR.get(selPair.left);
      RexNode constraintUDF = RexNodeTypeCheck.genConstraintsExpr(
          conf, cluster.getRexBuilder(), getTargetTable(qb, dest), updating(dest), inputRR);
      if (constraintUDF == null) {
        return null;
      }

      RelNode constraintRel = genFilterRelNode(constraintUDF, selPair.left, outerNameToPosMap, outerRR);

      List<RexNode> originalInputRefs = toRexNodeList(selPair.left);
      List<RexNode> selectedRefs = originalInputRefs.subList(0, selPair.right.getColumnInfos().size());
      return new Pair<>(genSelectRelNode(selectedRefs, selPair.right, constraintRel), selPair.right);
    }
This method creates a HiveFilter containing a filter expression to enforce constraints.
Constraints to check: not null, check
The return value is the pair of Constraint HiveFilter and the corresponding RowResolver
or null if the target has no constraint defined or all of them are disabled.
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java