private RelNode convertQueryOrInList( Blackboard bb, SqlNode seek, RelDataType targetRowType) { // NOTE: Once we start accepting single-row queries as row constructors, // there will be an ambiguity here for a case like X IN ((SELECT Y FROM // Z)). The SQL standard resolves the ambiguity by saying that a lone // select should be interpreted as a table expression, not a row // expression. The semantic difference is that a table expression can // return multiple rows. if (seek instanceof SqlNodeList) { return convertRowValues( bb, seek, ((SqlNodeList) seek).getList(), false, targetRowType); } else { return convertQueryRecursive(seek, false, null).project(); } }
private RelNode convertQueryOrInList( Blackboard bb, SqlNode seek, RelDataType targetRowType) { // NOTE: Once we start accepting single-row queries as row constructors, // there will be an ambiguity here for a case like X IN ((SELECT Y FROM // Z)). The SQL standard resolves the ambiguity by saying that a lone // select should be interpreted as a table expression, not a row // expression. The semantic difference is that a table expression can // return multiple rows. if (seek instanceof SqlNodeList) { return convertRowValues( bb, seek, ((SqlNodeList) seek).getList(), false, targetRowType); } else { return convertQueryRecursive(seek, false, null).project(); } }
private RelNode convertQueryOrInList( Blackboard bb, SqlNode seek, RelDataType targetRowType) { // NOTE: Once we start accepting single-row queries as row constructors, // there will be an ambiguity here for a case like X IN ((SELECT Y FROM // Z)). The SQL standard resolves the ambiguity by saying that a lone // select should be interpreted as a table expression, not a row // expression. The semantic difference is that a table expression can // return multiple rows. if (seek instanceof SqlNodeList) { return convertRowValues( bb, seek, ((SqlNodeList) seek).getList(), false, targetRowType); } else { return convertQueryRecursive(seek, false, null).project(); } }
private RelNode convertQueryOrInList( Blackboard bb, SqlNode seek, RelDataType targetRowType) { // NOTE: Once we start accepting single-row queries as row constructors, // there will be an ambiguity here for a case like X IN ((SELECT Y FROM // Z)). The SQL standard resolves the ambiguity by saying that a lone // select should be interpreted as a table expression, not a row // expression. The semantic difference is that a table expression can // return multiple rows. if (seek instanceof SqlNodeList) { return convertRowValues( bb, seek, ((SqlNodeList) seek).getList(), false, targetRowType); } else { return convertQueryRecursive(seek, false, null).project(); } }
/** * Converts a set operation (UNION, INTERSECT, MINUS) into relational * expressions. * * @param call Call to set operator * @return Relational expression */ protected RelNode convertSetOp(SqlCall call) { final RelNode left = convertQueryRecursive(call.operand(0), false, null).project(); final RelNode right = convertQueryRecursive(call.operand(1), false, null).project(); switch (call.getKind()) { case UNION: return LogicalUnion.create(ImmutableList.of(left, right), all(call)); case INTERSECT: return LogicalIntersect.create(ImmutableList.of(left, right), all(call)); case EXCEPT: return LogicalMinus.create(ImmutableList.of(left, right), all(call)); default: throw Util.unexpected(call.getKind()); } }
/** * Converts a set operation (UNION, INTERSECT, MINUS) into relational * expressions. * * @param call Call to set operator * @return Relational expression */ protected RelNode convertSetOp(SqlCall call) { final RelNode left = convertQueryRecursive(call.operand(0), false, null).project(); final RelNode right = convertQueryRecursive(call.operand(1), false, null).project(); switch (call.getKind()) { case UNION: return LogicalUnion.create(ImmutableList.of(left, right), all(call)); case INTERSECT: return LogicalIntersect.create(ImmutableList.of(left, right), all(call)); case EXCEPT: return LogicalMinus.create(ImmutableList.of(left, right), all(call)); default: throw Util.unexpected(call.getKind()); } }
protected RelNode convertInsert(SqlInsert call) { RelOptTable targetTable = getTargetTable(call); final RelDataType targetRowType = validator.getValidatedNodeType(call); assert targetRowType != null; RelNode sourceRel = convertQueryRecursive(call.getSource(), false, targetRowType).project(); RelNode massagedRel = convertColumnList(call, sourceRel); return createModify(targetTable, massagedRel); }
protected RelNode convertInsert(SqlInsert call) { RelOptTable targetTable = getTargetTable(call); final RelDataType targetRowType = validator.getValidatedNodeType(call); assert targetRowType != null; RelNode sourceRel = convertQueryRecursive(call.getSource(), false, targetRowType).project(); RelNode massagedRel = convertColumnList(call, sourceRel); return createModify(targetTable, massagedRel); }
/** * Converts a set operation (UNION, INTERSECT, MINUS) into relational * expressions. * * @param call Call to set operator * @return Relational expression */ protected RelNode convertSetOp(SqlCall call) { final RelNode left = convertQueryRecursive(call.operand(0), false, null).project(); final RelNode right = convertQueryRecursive(call.operand(1), false, null).project(); switch (call.getKind()) { case UNION: return LogicalUnion.create(ImmutableList.of(left, right), all(call)); case INTERSECT: return LogicalIntersect.create(ImmutableList.of(left, right), all(call)); case EXCEPT: return LogicalMinus.create(ImmutableList.of(left, right), all(call)); default: throw Util.unexpected(call.getKind()); } }
protected RelNode convertInsert(SqlInsert call) { RelOptTable targetTable = getTargetTable(call); final RelDataType targetRowType = validator.getValidatedNodeType(call); assert targetRowType != null; RelNode sourceRel = convertQueryRecursive(call.getSource(), false, targetRowType).project(); RelNode massagedRel = convertColumnList(call, sourceRel); return createModify(targetTable, massagedRel); }
protected RelNode convertInsert(SqlInsert call) { RelOptTable targetTable = getTargetTable(call); final RelDataType targetRowType = validator.getValidatedNodeType(call); assert targetRowType != null; RelNode sourceRel = convertQueryRecursive(call.getSource(), false, targetRowType).project(); RelNode massagedRel = convertColumnList(call, sourceRel); return createModify(targetTable, massagedRel); }
/** * Converts a set operation (UNION, INTERSECT, MINUS) into relational * expressions. * * @param call Call to set operator * @return Relational expression */ protected RelNode convertSetOp(SqlCall call) { final RelNode left = convertQueryRecursive(call.operand(0), false, null).project(); final RelNode right = convertQueryRecursive(call.operand(1), false, null).project(); switch (call.getKind()) { case UNION: return LogicalUnion.create(ImmutableList.of(left, right), all(call)); case INTERSECT: return LogicalIntersect.create(ImmutableList.of(left, right), all(call)); case EXCEPT: return LogicalMinus.create(ImmutableList.of(left, right), all(call)); default: throw Util.unexpected(call.getKind()); } }
RelNode result = convertQueryRecursive(query, top, null).rel; if (top) { if (isStream(query)) {
RelNode result = convertQueryRecursive(query, top, null).rel; if (top) { if (isStream(query)) {
if (!(query instanceof SqlNodeList)) { final SqlInOperator op = (SqlInOperator) call.getOperator(); root = convertQueryRecursive(query, false, null); final SqlNode operand = call.operand(0); List<SqlNode> nodes; call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); RelNode rel = root.rel; while (rel instanceof Project call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); return RexSubQuery.scalar(root.rel);
RelNode result = convertQueryRecursive(query, top, null).rel; if (top) { if (isStream(query)) {
query = call.operand(1); if (!(query instanceof SqlNodeList)) { root = convertQueryRecursive(query, false, null); final SqlNode operand = call.operand(0); List<SqlNode> nodes; call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); RelNode rel = root.rel; while (rel instanceof Project call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); return RexSubQuery.scalar(root.rel);
query = call.operand(1); if (!(query instanceof SqlNodeList)) { root = convertQueryRecursive(query, false, null); final SqlNode operand = call.operand(0); List<SqlNode> nodes; call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); RelNode rel = root.rel; while (rel instanceof Project call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); return RexSubQuery.scalar(root.rel);
RelNode result = convertQueryRecursive(query, top, null).rel; if (top) { if (isStream(query)) {
if (!(query instanceof SqlNodeList)) { final SqlInOperator op = (SqlInOperator) call.getOperator(); root = convertQueryRecursive(query, false, null); final SqlNode operand = call.operand(0); List<SqlNode> nodes; call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); RelNode rel = root.rel; while (rel instanceof Project call = (SqlCall) expr; query = Iterables.getOnlyElement(call.getOperandList()); root = convertQueryRecursive(query, false, null); return RexSubQuery.scalar(root.rel);