private RelNode genFilterRelNode(RexNode filterExpression, RelNode srcRel,
        ImmutableMap<String, Integer> outerNameToPosMap, RowResolver outerRR) {
      if (filterExpression.getType().getSqlTypeName() != SqlTypeName.BOOLEAN) {
        // Cast filterExpression with BOOLEAN if it is not BOOLEAN
        RelDataType booleanType = srcRel.getCluster().getTypeFactory().createSqlType(SqlTypeName.BOOLEAN);
        filterExpression = srcRel.getCluster().getRexBuilder()
            .makeCast(booleanType, filterExpression);
      }
      final ImmutableMap<String, Integer> hiveColNameCalcitePosMap =
          this.relToHiveColNameCalcitePosMap.get(srcRel);
      filterExpression = new CorrelationConverter(
          new InputContext(srcRel.getRowType(), hiveColNameCalcitePosMap, relToHiveRR.get(srcRel)),
          outerNameToPosMap, outerRR, subqueryId).apply(filterExpression);
      RexNode factoredFilterExpression = RexUtil
          .pullFactors(cluster.getRexBuilder(), filterExpression);
      RelNode filterRel = new HiveFilter(cluster, cluster.traitSetOf(HiveRelNode.CONVENTION), srcRel,
          HiveCalciteUtil.fixNullability(cluster.getRexBuilder(),
              factoredFilterExpression, RelOptUtil.getFieldTypeList(srcRel.getRowType())));
      this.relToHiveColNameCalcitePosMap.put(filterRel, hiveColNameCalcitePosMap);
      relToHiveRR.put(filterRel, relToHiveRR.get(srcRel));

      return filterRel;
    }
Generate Join Logical Plan Relnode by walking through the join AST.

@param aliasToRel
         Alias(Table/Relation alias) to RelNode; only read and not
         written in to by this method
@return
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/parse/CalcitePlanner.java