private static RelNode createEmptyEmptyRelHelper(SingleRel input) { return LogicalSort.create(input.getInput(), RelCollations.EMPTY, input.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0)), input.getCluster().getRexBuilder().makeExactLiteral(BigDecimal.valueOf(0))); } }
/** * Derives the output type of a collect relational expression. * * @param rel relational expression * @param fieldName name of sole output field * @return output type of a collect relational expression */ public static RelDataType deriveCollectRowType( SingleRel rel, String fieldName) { RelDataType childType = rel.getInput().getRowType(); assert childType.isStruct(); final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); RelDataType ret = SqlTypeUtil.createMultisetType( typeFactory, childType, false); ret = typeFactory.builder().add(fieldName, ret).build(); return typeFactory.createTypeWithNullability(ret, false); } }
/** * Derives the output type of a collect relational expression. * * @param rel relational expression * @param fieldName name of sole output field * @return output type of a collect relational expression */ public static RelDataType deriveCollectRowType( SingleRel rel, String fieldName) { RelDataType childType = rel.getInput().getRowType(); assert childType.isStruct(); final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); RelDataType ret = SqlTypeUtil.createMultisetType( typeFactory, childType, false); ret = typeFactory.builder().add(fieldName, ret).build(); return typeFactory.createTypeWithNullability(ret, false); } }