Examples of RowIteratorAdapter


Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

            }
            log.debug("{} SQL2 JOIN executed second branch, took {} ms.",
                    genString(printIndentation), System.currentTimeMillis()
                            - bTime);
            return new SimpleQueryResult(merger.getColumnNames(),
                    merger.getSelectorNames(), new RowIteratorAdapter(allRows));
        }

        Set<Row> leftRows = buildLeftRowsJoin(csInfo, leftCo, printIndentation
                + printIndentStep);
        if (log.isDebugEnabled()) {
            timeJoinLeftSide = System.currentTimeMillis() - timeJoinLeftSide;
            log.debug(genString(printIndentation) + "SQL2 JOIN LEFT SIDE took "
                    + timeJoinLeftSide + " ms. fetched " + leftRows.size()
                    + " rows.");
        }

        // The join constraint information is split into:
        // - rightConstraints selects just the 'ON' constraints
        // - csInfo has the 'WHERE' constraints
        //
        // So, in the case of an OUTER JOIN we'll run 2 queries, one with
        // 'ON'
        // and one with 'ON' + 'WHERE' conditions
        // this way, at merge time in case of an outer join we can tell if
        // it's a 'null' row, or a bad row -> one that must not be returned.
        // This way at the end we'll have:
        // - rightRowsSet containing the 'ON' dataset
        // - excludingOuterJoinRowsSet: the 'ON' + 'WHERE' condition
        // dataset, or
        // NULL if there is no 'WHERE' condition

        long timeJoinRightSide = System.currentTimeMillis();
        List<Constraint> rightConstraints = merger
                .getRightJoinConstraints(leftRows);
        Comparator<Row> rightCo = new RowPathComparator(
                merger.getRightSelectors());

        Set<Row> rightRows = buildRightRowsJoin(csInfo, rightConstraints,
                isOuterJoin, rightCo, printIndentation + printIndentStep);

        // this has to be initialized as null
        Set<Row> excludingOuterJoinRowsSet = null;
        if (isOuterJoin && csInfo.getRightConstraint() != null) {
            excludingOuterJoinRowsSet = buildRightRowsJoin(csInfo,
                    rightConstraints, false, rightCo, printIndentation
                            + printIndentStep);
        }

        if (log.isDebugEnabled()) {
            timeJoinRightSide = System.currentTimeMillis() - timeJoinRightSide;
            log.debug(genString(printIndentation)
                    + "SQL2 JOIN RIGHT SIDE took " + timeJoinRightSide
                    + " ms. fetched " + rightRows.size() + " rows.");
        }
        // merge left with right datasets
        return merger.merge(new RowIteratorAdapter(leftRows),
                new RowIteratorAdapter(rightRows), excludingOuterJoinRowsSet,
                rightCo);

    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

        // QueryEngine take care of sorting and applying offset and limit
        // constraints
        boolean externalSort = !NATIVE_SORT;
        RowIterator rows = null;
        try {
            rows = new RowIteratorAdapter(lqf.execute(columnMap, selector,
                    constraint, sort, externalSort, offset, limit));
        } catch (IOException e) {
            throw new RepositoryException("Failed to access the query index", e);
        } finally {
            log.debug(
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

                int size = rows.size();
                rows = rows.subList(0, (int) Math.min(limit, size));
            }

            return new SimpleQueryResult(result.getColumnNames(),
                    result.getSelectorNames(), new RowIteratorAdapter(rows));
        } else {
            return result;
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

                        // No matches in an outer join -> add a null row
                        rows.add(mergeRow(leftRow, null));
                    }
                }
            }
            joinRows = new RowIteratorAdapter(rows);
        } else if (JCR_JOIN_TYPE_LEFT_OUTER.equals(type)) {
            joinRows = new RowIteratorAdapter(leftRows) {
                @Override
                public Object next() {
                    return mergeRow((Row) super.next(), null);
                }
            };
        } else {
            joinRows = new RowIteratorAdapter(Collections.emptySet());
        }

        return new SimpleQueryResult(columnNames, selectorNames, joinRows);
    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

                    execute(null, right, rightConstraint, null, 0, -1);
                for (Row row : JcrUtils.getRows(rigthResult)) {
                    list.add(row);
                }
            }
            rightRows = new RowIteratorAdapter(list);
        }

        QueryResult result =
            merger.merge(new RowIteratorAdapter(leftRows), rightRows);
        return sort(result, orderings, offset, limit);
    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

            getColumnMap(columns, selectorMap);
        String[] columnNames =
            columnMap.keySet().toArray(new String[columnMap.size()]);

        try {
            RowIterator rows = new RowIteratorAdapter(lqf.execute(
                    columnMap, selector, constraint));
            QueryResult result =
                new SimpleQueryResult(columnNames, selectorNames, rows);
            return sort(result, orderings, offset, limit);
        } catch (IOException e) {
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

                rows = rows.subList(0, (int) Math.min(limit, size));
            }

            return new SimpleQueryResult(
                    result.getColumnNames(), result.getSelectorNames(),
                    new RowIteratorAdapter(rows));
        } else {
            return result;
        }
    }
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

        };
        final PrefetchIterator<RowImpl> prefIt = new  PrefetchIterator<RowImpl>(
                rowIterator,
                PREFETCH_MIN, PREFETCH_TIMEOUT, PREFETCH_MAX,
                result.getSize());
        return new RowIteratorAdapter(prefIt) {
            @Override
            public long getSize() {
                return prefIt.size();
            }
        };
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

        };
        final PrefetchIterator<RowImpl> prefIt = new  PrefetchIterator<RowImpl>(
                rowIterator,
                PREFETCH_MIN, PREFETCH_TIMEOUT, PREFETCH_MAX,
                result.getSize());
        return new RowIteratorAdapter(prefIt) {
            @Override
            public long getSize() {
                return prefIt.size();
            }
        };
View Full Code Here

Examples of org.apache.jackrabbit.commons.iterator.RowIteratorAdapter

        };
        final PrefetchIterator<RowImpl> prefIt = new  PrefetchIterator<RowImpl>(
                rowIterator,
                PREFETCH_MIN, PREFETCH_TIMEOUT, PREFETCH_MAX,
                result.getSize());
        return new RowIteratorAdapter(prefIt) {
            @Override
            public long getSize() {
                return prefIt.size();
            }
        };
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.