/** * * @param partsMap Partitions map. * @param parts Partitions. * @return Result. */ private static Map<ClusterNode, IntArray> narrowForQuery(Map<ClusterNode, IntArray> partsMap, int[] parts) { if (parts == null) return partsMap; Map<ClusterNode, IntArray> cp = U.newHashMap(partsMap.size()); for (Map.Entry<ClusterNode, IntArray> entry : partsMap.entrySet()) { IntArray filtered = new IntArray(parts.length); IntArray orig = entry.getValue(); for (int i = 0; i < orig.size(); i++) { int p = orig.get(i); if (Arrays.binarySearch(parts, p) >= 0) filtered.add(p); } if (filtered.size() > 0) cp.put(entry.getKey(), filtered); } return cp.isEmpty() ? null : cp; }
/** * Allocate a number of pages. * * @param list the list where to add the allocated pages * @param pagesToAllocate the number of pages to allocate * @param exclude the exclude list * @param after all allocated pages are higher than this page */ void allocatePages(IntArray list, int pagesToAllocate, BitField exclude, int after) { list.ensureCapacity(list.size() + pagesToAllocate); for (int i = 0; i < pagesToAllocate; i++) { int page = allocatePage(exclude, after); after = page; list.add(page); } }
target.set(idx, param); paramIdxs.add(idx);
partIds.add(partId);
dataPages.add(d);
paramColumnIndex.add(i);
res.put(n, parts = new IntArray()); parts.add(p);
public void addValueSorted(int value) { int l = 0, r = size; while (l < r) { int i = (l + r) >>> 1; int d = data[i]; if (d == value) { return; } else if (d > value) { r = i; } else { l = i + 1; } } add(l, value); }
public void add(int i, int value) { if (SysProperties.CHECK && i > size) { throw new ArrayIndexOutOfBoundsException("i=" + i + " size=" + size); } checkCapacity(); if (i == size) { add(value); } else { System.arraycopy(data, i, data, i + 1, size - i); data[i] = value; size++; } }
private void setBlockCount(int count) { fileBlockCount = count; int pages = getPage(count); while (pages >= pageOwners.size()) { pageOwners.add(FREE_PAGE); } }
void free(int pos, int blockCount) { file.free(pos, blockCount); if (freeList.size() < FREE_LIST_SIZE) { freeList.add(pos); } }
/** */ private Map<ClusterNode, IntArray> narrowForQuery(Map<ClusterNode, IntArray> partsMap, int[] parts) { if (parts == null) return partsMap; Map<ClusterNode, IntArray> cp = U.newHashMap(partsMap.size()); for (Map.Entry<ClusterNode, IntArray> entry : partsMap.entrySet()) { IntArray filtered = new IntArray(parts.length); IntArray orig = entry.getValue(); for (int i = 0; i < orig.size(); i++) { int p = orig.get(i); if (Arrays.binarySearch(parts, p) >= 0) filtered.add(p); } if (filtered.size() > 0) cp.put(entry.getKey(), filtered); } return cp.isEmpty() ? null : cp; }
/** * Allocate a number of pages. * * @param list the list where to add the allocated pages * @param pagesToAllocate the number of pages to allocate * @param exclude the exclude list * @param after all allocated pages are higher than this page */ void allocatePages(IntArray list, int pagesToAllocate, BitField exclude, int after) { list.ensureCapacity(list.size() + pagesToAllocate); for (int i = 0; i < pagesToAllocate; i++) { int page = allocatePage(exclude, after); after = page; list.add(page); } }
/** * Allocate a number of pages. * * @param list the list where to add the allocated pages * @param pagesToAllocate the number of pages to allocate * @param exclude the exclude list * @param after all allocated pages are higher than this page */ void allocatePages(IntArray list, int pagesToAllocate, BitField exclude, int after) { list.ensureCapacity(list.size() + pagesToAllocate); for (int i = 0; i < pagesToAllocate; i++) { int page = allocatePage(exclude, after); after = page; list.add(page); } }
target.set(idx, param); paramIdxs.add(idx);
public BtreePage split(Session session, int splitPoint) throws SQLException { ObjectArray data = new ObjectArray(); IntArray children = new IntArray(); splitPoint++; int max = pageData.size(); if (SysProperties.CHECK && index.getDatabase().getLogIndexChanges() && !getDeleted()) { // page must have been deleted already before calling // getSplitPoint() throw Message.getInternalError(); } for (int i = splitPoint; i < max; i++) { data.add(getData(splitPoint)); children.add(getChild(splitPoint)); pageData.remove(splitPoint); pageChildren.remove(splitPoint); } children.add(getChild(splitPoint)); pageData.remove(splitPoint - 1); pageChildren.remove(splitPoint); BtreeNode n2 = new BtreeNode(index, children, data); index.updatePage(session, this); index.addPage(session, n2); return n2; }