/** Creates an IN sub-query. */ public static RexSubQuery in(RelNode rel, ImmutableList<RexNode> nodes) { final RelDataType type = type(rel, nodes); return new RexSubQuery(type, SqlStdOperatorTable.IN, nodes, rel); }
/** Creates a SOME sub-query. * * <p>There is no ALL. For {@code x comparison ALL (sub-query)} use instead * {@code NOT (x inverse-comparison SOME (sub-query))}. * If {@code comparison} is {@code >} * then {@code negated-comparison} is {@code <=}, and so forth. */ public static RexSubQuery some(RelNode rel, ImmutableList<RexNode> nodes, SqlQuantifyOperator op) { assert op.kind == SqlKind.SOME; final RelDataType type = type(rel, nodes); return new RexSubQuery(type, op, nodes, rel); }
@Override public RexSubQuery clone(RelDataType type, List<RexNode> operands) { return new RexSubQuery(type, getOperator(), ImmutableList.copyOf(operands), rel); }
public RexSubQuery clone(RelNode rel) { return new RexSubQuery(type, getOperator(), operands, rel); } }
@Override public RexSubQuery clone(RelDataType type, List<RexNode> operands) { return new RexSubQuery(type, getOperator(), ImmutableList.copyOf(operands), rel); }
/** Creates an IN sub-query. */ public static RexSubQuery in(RelNode rel, ImmutableList<RexNode> nodes) { final RelDataType type = type(rel, nodes); return new RexSubQuery(type, SqlStdOperatorTable.IN, nodes, rel); }
/** Creates a SOME sub-query. * * <p>There is no ALL. For {@code x comparison ALL (sub-query)} use instead * {@code NOT (x inverse-comparison SOME (sub-query))}. * If {@code comparison} is {@code >} * then {@code negated-comparison} is {@code <=}, and so forth. */ public static RexSubQuery some(RelNode rel, ImmutableList<RexNode> nodes, SqlQuantifyOperator op) { assert op.kind == SqlKind.SOME; final RelDataType type = type(rel, nodes); return new RexSubQuery(type, op, nodes, rel); }
public RexSubQuery clone(RelNode rel) { return new RexSubQuery(type, getOperator(), operands, rel); } }
/** Creates an EXISTS sub-query. */ public static RexSubQuery exists(RelNode rel) { final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); final RelDataType type = typeFactory.createSqlType(SqlTypeName.BOOLEAN); return new RexSubQuery(type, SqlStdOperatorTable.EXISTS, ImmutableList.of(), rel); }
/** Creates an EXISTS sub-query. */ public static RexSubQuery exists(RelNode rel) { final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); final RelDataType type = typeFactory.createSqlType(SqlTypeName.BOOLEAN); return new RexSubQuery(type, SqlStdOperatorTable.EXISTS, ImmutableList.of(), rel); }
/** Creates a scalar sub-query. */ public static RexSubQuery scalar(RelNode rel) { final List<RelDataTypeField> fieldList = rel.getRowType().getFieldList(); assert fieldList.size() == 1; final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); final RelDataType type = typeFactory.createTypeWithNullability(fieldList.get(0).getType(), true); return new RexSubQuery(type, SqlStdOperatorTable.SCALAR_QUERY, ImmutableList.of(), rel); }
/** Creates a scalar sub-query. */ public static RexSubQuery scalar(RelNode rel) { final List<RelDataTypeField> fieldList = rel.getRowType().getFieldList(); assert fieldList.size() == 1; final RelDataTypeFactory typeFactory = rel.getCluster().getTypeFactory(); final RelDataType type = typeFactory.createTypeWithNullability(fieldList.get(0).getType(), true); return new RexSubQuery(type, SqlStdOperatorTable.SCALAR_QUERY, ImmutableList.of(), rel); }