@Override protected BindingSet convert(BindingSet sourceBindings) throws QueryEvaluationException { return project(projection.getProjectionElemList(), sourceBindings, parentBindings, !isOuterProjection); }
@Override public ImmutableList<ProjectionElemList> getProjectionElemList() { if (projection instanceof Projection) { return ImmutableList.of(((Projection) projection).getProjectionElemList()); } else if (projection instanceof MultiProjection) { return ImmutableList.copyOf(((MultiProjection) projection).getProjections()); } else return ImmutableList.of(); }
@Override protected BindingSet convert(BindingSet sourceBindings) throws QueryEvaluationException { return project(projection.getProjectionElemList(), sourceBindings, parentBindings, !isOuterProjection); }
@Override public String getSignature() { return "(External Projection) " + Joiner.on(", ").join(tupleExpr.getProjectionElemList().getElements()).replaceAll("\\s+", " "); }
/** * Make a {@link ProjectionEvaluator} that processes the logic of a {@link Projection}. * * @param projection - Defines the projection that will be processed. (not null) * @return A {@link ProjectionEvaluator} for the provided {@link Projection}. */ public static ProjectionEvaluator make(final Projection projection) { requireNonNull(projection); final ProjectionElemList projectionElems = projection.getProjectionElemList(); final TupleExpr arg = projection.getArg(); final Optional<Extension> extension = arg instanceof Extension ? Optional.of((Extension)arg) : Optional.empty(); return new ProjectionEvaluator(projectionElems, extension); }
@Override public String getSignature() { return "(Mongo PcjQueryNode) " + Joiner.on(", ").join(super.getTupleExpr().getProjectionElemList().getElements()).replaceAll("\\s+", " "); } }
@Override public String getSignature() { return "(SimpleExternalTupleSet) " + Joiner.on(", ") .join(this.getTupleExpr().getProjectionElemList() .getElements()).replaceAll("\\s+", " "); } }
@Override public boolean equals(Object other) { if (other instanceof Projection && super.equals(other)) { Projection o = (Projection)other; return projElemList.equals(o.getProjectionElemList()); } return false; }
private static VariableOrder getConstructGraphVarOrder(final Reduced node) { //get child node final QueryModelNode child = node.getArg(); Preconditions.checkArgument(child instanceof Projection || child instanceof MultiProjection); final UnaryTupleOperator unary = (UnaryTupleOperator) child; //get ProjectionElemList to build ConstructGraph final List<ProjectionElemList> projections = new ArrayList<>(); if(unary instanceof Projection) { projections.add(((Projection) unary).getProjectionElemList()); } else { projections.addAll(((MultiProjection)unary).getProjections()); } return getConstructGraphVarOrder(projections); }
@Override public boolean equals(Object other) { if (other instanceof Projection && super.equals(other)) { Projection o = (Projection)other; return projElemList.equals(o.getProjectionElemList()); } return false; }
@Override public void meet(Projection node) throws RuntimeException { super.meet(node); ProjectionElemList list = node.getProjectionElemList(); String set = null; StringBuilder projList = new StringBuilder(); boolean first = true; //TODO: we do not support projections from multiple pig statements yet for (String name : list.getTargetNames()) { set = varToSet.get(name); //TODO: overwrite if (set == null) { throw new IllegalArgumentException("Have not found any pig logic for name[" + name + "]"); } if (!first) { projList.append(","); } first = false; projList.append(name); } if (set == null) throw new IllegalArgumentException(""); //TODO: Fill this //SUBORG = FOREACH SUBORG_L GENERATE dept, univ; pigScriptBuilder.append("PROJ = FOREACH ").append(set).append(" GENERATE ").append(projList.toString()).append(";\n"); }
@Override public boolean push(BindingSet bs) throws InterruptedException { return parent.push(bs == null ? null : ProjectionIterator.project(projection.getProjectionElemList(), bs, bindings, includeAll)); } }, projection.getArg(), pushDownBindings);
@Override public void meet(Projection projection) { if (projection.getArg() instanceof Extension) { recordConsequent(projection.getProjectionElemList(), ((Extension) projection.getArg()).getElements()); } else { recordConsequent(projection.getProjectionElemList(), Arrays.asList()); } }
@Override public Projection clone() { Projection clone = (Projection)super.clone(); clone.setProjectionElemList(getProjectionElemList().clone()); return clone; }
@Override public Projection clone() { Projection clone = (Projection)super.clone(); clone.setProjectionElemList(getProjectionElemList().clone()); return clone; }
@Override public void meet(Var node) { if (projection != null) { boolean projected = false; for (ProjectionElem e : projection.getProjectionElemList().getElements()) { String source = e.getSourceName(); String target = e.getTargetName(); if (node.getName().equals(source) && node.getName().equals(target)) { projected = true; break; } } if (!projected) { variablesProjected = false; } } }
@Override public void meet(Var node) { if (projection != null) { boolean projected = false; for (ProjectionElem e : projection.getProjectionElemList().getElements()) { String source = e.getSourceName(); String target = e.getTargetName(); if (node.getName().equals(source) && node.getName().equals(target)) { projected = true; break; } } if (!projected) { variablesProjected = false; } } }
@Override public void meet(Projection projectionNode) throws Exception { projectionNode.visitChildren(this); if (projectionNode.getArg() instanceof AggregationPipelineQueryNode && projectionNode.getParentNode() != null) { AggregationPipelineQueryNode pipelineNode = (AggregationPipelineQueryNode) projectionNode.getArg(); if (pipelineNode.project(Arrays.asList(projectionNode.getProjectionElemList()))) { projectionNode.replaceWith(pipelineNode); } } }
if (projection.isSubquery()) { pushDownBindings = new QueryBindingSet(); for (ProjectionElem pe : projection.getProjectionElemList().getElements()) { Value targetValue = bindings.getValue(pe.getSourceName()); if (targetValue != null) {
@Override public void meet(Projection node) throws RDFHandlerException { ExtensionContext oldInlineBindings = meetExtension(node.getArg()); if (isSubQuery) { listEntry(); handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.SUB_QUERY_CLASS)); Resource queryBNode = valueFactory.createBNode(); handler.handleStatement(valueFactory.createStatement(subject, SP.QUERY_PROPERTY, queryBNode)); subject = queryBNode; handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.SELECT_CLASS)); } node.getProjectionElemList().visit(this); visitWhere(node.getArg()); node.getArg().visit(new GroupVisitor()); node.getArg().visit(new OrderVisitor()); inlineBindings = oldInlineBindings; hasGroup = false; }