private void setActiveDevices(TableScanOperator t, CNFFilter filter, Operator o) throws Exception { if (t.isSingleDeviceSet()) { t.addActiveDeviceForParent(t.getSingleDevice(), o); return; } if (t.deviceIsHash()) { if (filter != null && filter.hashFiltersPartitions(t.getDeviceHash())) { if (t.allDevices()) { t.addActiveDeviceForParent((int) (filter.getPartitionHash() % t.getNumDevices()), o); } else { t.addActiveDeviceForParent( t.deviceSet().get((int) (filter.getPartitionHash() % t.getNumDevices())), o); } } else { if (t.allDevices()) { int i = 0; while (i < t.getNumDevices()) { t.addActiveDeviceForParent(i, o); i++; } } else { for (final int j : t.deviceSet()) { t.addActiveDeviceForParent(j, o); } } } } else { // device range if (filter != null && filter.rangeFiltersPartitions(t.getDeviceRangeCol())) { final ArrayList<Filter> f = filter.getRangeFilters(); // handle devices all or devices set final ArrayList<Integer> devices = t.getDevicesMatchingRangeFilters(f); t.addActiveDevicesForParent(devices, o); } else { if (t.allDevices()) { int i = 0; while (i < t.getNumDevices()) { t.addActiveDeviceForParent(i, o); i++; } } else { for (final int j : t.deviceSet()) { t.addActiveDeviceForParent(j, o); } } } } }
private ArrayList<Integer> determineHashMapEntries(TableScanOperator t, CNFFilter filter) throws Exception { if (t.isSingleNodeGroupSet()) { final ArrayList<Integer> retval = new ArrayList<Integer>(1); retval.add(t.getSingleNodeGroup()); return retval; } if (t.nodeGroupIsHash()) { if (filter != null && filter.hashFiltersPartitions(t.getNodeGroupHash())) { final ArrayList<Integer> retval = new ArrayList<Integer>(1); retval.add(t.nodeGroupSet().get((int) (filter.getPartitionHash() % t.getNumNodeGroups()))); return retval; } else { final ArrayList<Integer> retval = new ArrayList<Integer>(t.getNodeGroupHashMap().size()); for (final int id : t.getNodeGroupHashMap().keySet()) { retval.add(id); } return retval; } } else { // node group range if (filter != null && filter.rangeFiltersPartitions(t.getNodeGroupRangeCol())) { final ArrayList<Filter> f = filter.getRangeFilters(); final ArrayList<Integer> devices = t.getNodeGroupsMatchingRangeFilters(f); return devices; } else { final ArrayList<Integer> retval = new ArrayList<Integer>(t.getNodeGroupHashMap().size()); for (final int id : t.getNodeGroupHashMap().keySet()) { retval.add(id); } return retval; } } }
private void setActiveNodes( TableScanOperator t, CNFFilter filter, Operator o, ArrayList<ArrayList<Integer>> nodeLists) throws Exception { if (t.isSingleNodeSet()) { for (final ArrayList<Integer> nodeList : nodeLists) { if (t.getSingleNode() == -1) { t.addActiveNodeForParent(-1, o); } else { t.addActiveNodeForParent(nodeList.get(t.getSingleNode()), o); } } return; } if (t.nodeIsHash()) { if (filter != null && filter.hashFiltersPartitions(t.getNodeHash())) { if (t.allNodes()) { for (final ArrayList<Integer> nodeList : nodeLists) { t.addActiveNodeForParent( nodeList.get((int) (filter.getPartitionHash() % nodeList.size())), o); } } else { for (final ArrayList<Integer> nodeList : nodeLists) { t.addActiveNodeForParent( nodeList.get(t.nodeSet().get((int) (filter.getPartitionHash() % t.getNumNodes()))), o); } } } else { if (t.allNodes()) { for (final ArrayList<Integer> nodeList : nodeLists) { for (final Integer node : nodeList) { t.addActiveNodeForParent(node, o); } } } else { for (final int j : t.nodeSet()) { for (final ArrayList<Integer> nodeList : nodeLists) { t.addActiveNodeForParent(nodeList.get(j), o); } } } } } else { // node range if (filter != null && filter.rangeFiltersPartitions(t.getNodeRangeCol())) { final ArrayList<Filter> f = filter.getRangeFilters(); // handle nodes all or nodes set final ArrayList<Integer> nodes = t.getNodesMatchingRangeFilters(f); for (final Integer node : nodes) { for (final ArrayList<Integer> nodeList : nodeLists) { t.addActiveNodeForParent(nodeList.get(node), o); } } } else { if (t.allNodes()) { for (final ArrayList<Integer> nodeList : nodeLists) { for (final Integer node : nodeList) { t.addActiveNodeForParent(node, o); } } } else { for (final int j : t.nodeSet()) { for (final ArrayList<Integer> nodeList : nodeLists) { t.addActiveNodeForParent(nodeList.get(j), o); } } } } } }