/** * Returns the document identifier. */ public DocId getDocId() { if (docId == null) { docId = block.getIdExtractor().getDocId(doc); } return docId; }
public DocIdExtractor(Path[] identityFields) { init(identityFields); }
/** * Returns the identity fields for the entity */ public Path[] getIdentityFields() { return idx.getIdentityFields(); }
DocIdExtractor docIdx = new DocIdExtractor(md); Path[] identityFields = docIdx.getIdentityFields(); DocCtx doc=docStream.next(); if(!doc.hasErrors()) { DocId id = docIdx.getDocId(doc); List<QueryExpression> idList = new ArrayList<>(identityFields.length); for (int ix = 0; ix < identityFields.length; ix++) {
public QueryPlanNodeExecutor(QueryPlanNode node, Factory factory, CompositeMetadata root, Map<DocId,JsonDoc> documentCache) { this.node=node; this.finder=new SimpleFindImpl(node.getMetadata(),factory); LOGGER.debug("Creating finder for {} for node {}",node.getMetadata().getName(),node.getName()); docIdx=new DocIdExtractor(node.getMetadata()); this.root=root; this.documentCache=documentCache; if(node.getMetadata().getParent()!=null) { resolvedReference=root.getResolvedReferenceOfField(node.getMetadata().getEntityPath()); } else { resolvedReference=null; } LOGGER.debug("ctor {}: resolved reference={}",node.getName(),resolvedReference); }
DocIdExtractor docIdx = new DocIdExtractor(md); Path[] identityFields = docIdx.getIdentityFields(); DocCtx doc=docStream.next(); if(!doc.hasErrors()) { DocId id = docIdx.getDocId(doc); List<QueryExpression> idList = new ArrayList<>(identityFields.length); for (int ix = 0; ix < identityFields.length; ix++) {
public ExecutionBlock(CompositeMetadata root, QueryPlanNode qpNode) { this.rootMd = root; this.qpNode = qpNode; Field[] f = getMetadata().getEntitySchema().getIdentityFields(); Path[] identityFields = new Path[f.length]; for (int i = 0; i < f.length; i++) { identityFields[i] = getMetadata().getEntityRelativeFieldName(f[i]); } idx = new DocIdExtractor(identityFields); Path entityPath = getMetadata().getEntityPath(); if (entityPath.isEmpty()) { reference = null; } else { reference = root.getDescendantReference(entityPath); } }
public DocIdExtractor(Path[] identityFields) { init(identityFields); }
/** * Returns the document identifier. */ public DocId getDocId() { if (docId == null) { docId = block.getIdExtractor().getDocId(doc); } return docId; }
public ExecutionBlock(CompositeMetadata root, QueryPlanNode qpNode) { this.rootMd = root; this.qpNode = qpNode; Field[] f = getMetadata().getEntitySchema().getIdentityFields(); Path[] identityFields = new Path[f.length]; for (int i = 0; i < f.length; i++) { identityFields[i] = getMetadata().getEntityRelativeFieldName(f[i]); } idx = new DocIdExtractor(identityFields); Path entityPath = getMetadata().getEntityPath(); if (entityPath.isEmpty()) { reference = null; } else { reference = root.getDescendantReference(entityPath); } }
/** * Returns the identity fields for the entity */ public Path[] getIdentityFields() { return idx.getIdentityFields(); }
public DocIdExtractor(Path[] identityFields) { init(identityFields); }
private void execute(OperationContext ctx, CRUDFindRequest findRequest, List<QueryPlanDoc> parents) { OperationContext nodeCtx=ctx.getDerivedOperationContext(node.getMetadata().getName(),findRequest); LOGGER.debug("execute {}: entity={}, findRequest.query={}, projection={}, sort={}", node.getName(), nodeCtx.getEntityName(), findRequest.getQuery(),findRequest.getProjection(),findRequest.getSort()); // note the response is not used, but find method changes the supplied context. finder.find(nodeCtx,findRequest); LOGGER.debug("execute {}: storing documents", node.getName()); for(DocCtx doc:nodeCtx.getDocuments()) { DocId id=docIdx.getDocId(doc.getOutputDocument()); if(documentCache!=null) { JsonDoc jdoc=documentCache.get(id); if(jdoc==null) { jdoc=doc.getOutputDocument(); documentCache.put(id,jdoc); } } QueryPlanDoc qplanDoc=new QueryPlanDoc(doc.getOutputDocument(),id,node); docs.add(qplanDoc); } if(parents!=null) { for(QueryPlanDoc parent:parents) { parent.addChildren(node,docs); } } } }
private JsonNode toJson(ToJsonCb<Step> cb) { ObjectNode o = JsonNodeFactory.instance.objectNode(); ArrayNode arr = JsonNodeFactory.instance.arrayNode(); for (Path p : idx.getIdentityFields()) { arr.add(JsonNodeFactory.instance.textNode(p.toString())); } o.set("unique", arr); o.set("source", cb.toJson(source.getStep())); return o; }
/** * Creates a document ID extractfor with the given identity fields */ public DocIdExtractor(Field[] identityFields) { if (identityFields == null || identityFields.length == 0) { throw new IllegalArgumentException("Empty identity fields"); } Path[] f = new Path[identityFields.length]; for (int i = 0; i < f.length; i++) { f[i] = identityFields[i].getFullPath(); } init(f); }
private JsonNode toJson(ToJsonCb<Step> cb) { ObjectNode o = JsonNodeFactory.instance.objectNode(); ArrayNode arr = JsonNodeFactory.instance.arrayNode(); for (Path p : idx.getIdentityFields()) { arr.add(JsonNodeFactory.instance.textNode(p.toString())); } o.set("unique", arr); o.set("source", cb.toJson(source.getStep())); return o; }
/** * Creates a document ID extractor for the given schema */ public DocIdExtractor(EntitySchema sch) { Field[] identityFields = sch.getIdentityFields(); if (identityFields == null || identityFields.length == 0) { throw new IllegalArgumentException("Empty identity fields"); } Path[] f = new Path[identityFields.length]; for (int i = 0; i < f.length; i++) { f[i] = sch.getEntityRelativeFieldName(identityFields[i]); } init(f); }
/** * Creates a document ID extractor for the given schema */ public DocIdExtractor(EntitySchema sch) { Field[] identityFields = sch.getIdentityFields(); if (identityFields == null || identityFields.length == 0) { throw new IllegalArgumentException("Empty identity fields"); } Path[] f = new Path[identityFields.length]; for (int i = 0; i < f.length; i++) { f[i] = sch.getEntityRelativeFieldName(identityFields[i]); } init(f); }