@Override public String prettyPrint(int depth, int indent) { String result = ""; String ind = OExecutionStepInternal.getIndent(depth, indent); int[] blockSizes = new int[subPlans.size()]; for (int i = 0; i < subPlans.size(); i++) { OInternalExecutionPlan currentPlan = subPlans.get(subPlans.size() - 1 - i); String partial = currentPlan.prettyPrint(0, indent); String[] partials = partial.split("\n"); blockSizes[subPlans.size() - 1 - i] = partials.length + 2; result = "+-------------------------\n" + result; for (int j = 0; j < partials.length; j++) { String p = partials[partials.length - 1 - j]; if (result.length() > 0) { result = appendPipe(p) + "\n" + result; } else { result = appendPipe(p); } } result = "+-------------------------\n" + result; } result = addArrows(result, blockSizes); result += foot(blockSizes); result = ind + result; result = result.replaceAll("\n", "\n" + ind); result = head(depth, indent, subPlans.size()) + "\n" + result; return result; }
private void fetchNextRecord() { fetchNextRecord(resultSets.size() - 1); }
private String head(int depth, int indent, int nItems) { String ind = OExecutionStepInternal.getIndent(depth, indent); String result = ind + "+ CARTESIAN PRODUCT"; if (profilingEnabled) { result += " (" + getCostFormatted() + ")"; } return result; }
private void fetchNextRecord(int level) { OResultSet currentRs = resultSets.get(level); if (!currentRs.hasNext()) { if (level <= 0) { nextRecord = null; currentTuple = null; return; } currentRs = preFetches.get(level); currentRs.reset(); resultSets.set(level, currentRs); currentTuple.set(level, currentRs.next()); fetchNextRecord(level - 1); } else { currentTuple.set(level, currentRs.next()); } buildNextRecord(); }
CartesianProductStep step = new CartesianProductStep(context, enableProfiling); for (Pattern subPattern : subPatterns) { step.addSubPlan(createPlanForPattern(subPattern, context, estimatedRootEntries, aliasesToPrefetch, enableProfiling));
private void fetchFirstRecord() { int i = 0; for (OResultSet rs : resultSets) { if (!rs.hasNext()) { nextRecord = null; return; } OResult item = rs.next(); currentTuple.add(item); completedPrefetch.add(false); } buildNextRecord(); }
private void init(OCommandContext ctx) { if (subPlans == null || subPlans.isEmpty()) { return; } if (inited) { return; } for (OInternalExecutionPlan plan : subPlans) { resultSets.add(new OLocalResultSet(plan)); this.preFetches.add(new OInternalResultSet()); } fetchFirstRecord(); inited = true; }