private static boolean[] getSortOrders(FieldList keys, boolean[] orders) { if (orders == null) { orders = new boolean[keys.size()]; Arrays.fill(orders, true); } return orders; }
private static final boolean[] getSortOrders(FieldList keys, boolean[] orders) { if (orders == null) { orders = new boolean[keys.size()]; Arrays.fill(orders, true); } return orders; } }
@Override public boolean areCoFulfilled(RequestedLocalProperties requested1, RequestedLocalProperties requested2, LocalProperties produced1, LocalProperties produced2) { int numRelevantFields = this.keys1.size(); return checkSameOrdering(produced1, produced2, numRelevantFields); }
public DualInputPlanNode(OptimizerNode template, String nodeName, Channel input1, Channel input2, DriverStrategy diverStrategy, FieldList driverKeyFields1, FieldList driverKeyFields2) { this(template, nodeName, input1, input2, diverStrategy, driverKeyFields1, driverKeyFields2, SingleInputPlanNode.getTrueArray(driverKeyFields1.size())); }
@Override public boolean areCoFulfilled(RequestedLocalProperties requested1, RequestedLocalProperties requested2, LocalProperties produced1, LocalProperties produced2) { int numRelevantFields = this.keys1.size(); return checkSameOrdering(produced1, produced2, numRelevantFields); }
public Integer getFieldNumber(int index) { if (index < 0 || index >= this.indexes.size()) { throw new IndexOutOfBoundsException(String.valueOf(index)); } return this.indexes.get(index); }
public SingleInputPlanNode(OptimizerNode template, String nodeName, Channel input, DriverStrategy driverStrategy, FieldList driverKeyFields) { this(template, nodeName, input, driverStrategy, driverKeyFields, getTrueArray(driverKeyFields.size())); }
public int[] getFieldPositions() { final int[] ia = new int[this.indexes.size()]; for (int i = 0; i < ia.length; i++) { ia[i] = this.indexes.get(i); } return ia; }
/** * Sets the key field indexes for the specified driver comparator. * * @param keys The key field indexes for the specified driver comparator. * @param id The ID of the driver comparator. */ public void setDriverKeyInfo(FieldList keys, int id) { this.setDriverKeyInfo(keys, getTrueArray(keys.size()), id); }
@Override public DualInputPlanNode instantiate(Channel in1, Channel in2, TwoInputNode node) { boolean[] inputOrders = in2.getLocalProperties().getOrdering() == null ? null : in2.getLocalProperties().getOrdering().getFieldSortDirections(); if (inputOrders == null || inputOrders.length < this.keys2.size()) { throw new CompilerException("BUG: The input strategy does not sufficiently describe the sort orders for a CoGroup operator."); } else if (inputOrders.length > this.keys2.size()) { boolean[] tmp = new boolean[this.keys2.size()]; System.arraycopy(inputOrders, 0, tmp, 0, tmp.length); inputOrders = tmp; } return new DualInputPlanNode(node, "CoGroup ("+node.getOperator().getName()+")", in1, in2, DriverStrategy.CO_GROUP, this.keys1, this.keys2, inputOrders); }
@Override public DualInputPlanNode instantiate(Channel in1, Channel in2, TwoInputNode node) { boolean[] inputOrders = in1.getLocalProperties().getOrdering() == null ? null : in1.getLocalProperties().getOrdering().getFieldSortDirections(); if (inputOrders == null || inputOrders.length < this.keys1.size()) { throw new CompilerException("BUG: The input strategy does not sufficiently describe the sort orders for a CoGroup operator."); } else if (inputOrders.length > this.keys1.size()) { boolean[] tmp = new boolean[this.keys1.size()]; System.arraycopy(inputOrders, 0, tmp, 0, tmp.length); inputOrders = tmp; } return new DualInputPlanNode(node, "CoGroup ("+node.getOperator().getName()+")", in1, in2, DriverStrategy.CO_GROUP, this.keys1, this.keys2, inputOrders); }
@Override public DualInputPlanNode instantiate(Channel in1, Channel in2, TwoInputNode node) { boolean[] inputOrders = in1.getLocalProperties().getOrdering() == null ? null : in1.getLocalProperties().getOrdering().getFieldSortDirections(); if (inputOrders == null || inputOrders.length < this.keys1.size()) { throw new CompilerException("BUG: The input strategy does not sufficiently describe the sort orders for a CoGroup operator."); } else if (inputOrders.length > this.keys1.size()) { boolean[] tmp = new boolean[this.keys1.size()]; System.arraycopy(inputOrders, 0, tmp, 0, tmp.length); inputOrders = tmp; } return new DualInputPlanNode(node, "CoGroup (" + node.getOperator().getName() + ")", in1, in2, DriverStrategy.CO_GROUP_RAW, this.keys1, this.keys2, inputOrders); }
public boolean isValidUnorderedPrefix(FieldSet set) { if (set.size() > size()) { return false; } List<Integer> list = get(); for (int i = 0; i < set.size(); i++) { if (!set.contains(list.get(i))) { return false; } } return true; }
public static Ordering createOrdering(FieldList fields, boolean[] directions) { final Ordering o = new Ordering(); for (int i = 0; i < fields.size(); i++) { o.appendOrdering(fields.get(i), null, directions == null || directions[i] ? Order.ASCENDING : Order.DESCENDING); } return o; }
public static Ordering createOrdering(FieldList fields) { final Ordering o = new Ordering(); for (int i = 0; i < fields.size(); i++) { o.appendOrdering(fields.get(i), null, Order.ANY); } return o; }
@Override public LocalProperties computeLocalProperties(LocalProperties in1, LocalProperties in2) { // uniqueness becomes grouping with streamed nested loops if ((in2.getGroupedFields() == null || in2.getGroupedFields().size() == 0) && in2.getUniqueFields() != null && in2.getUniqueFields().size() > 0) { return LocalProperties.forGrouping(in2.getUniqueFields().iterator().next().toFieldList()); } else { return in2.clearUniqueFieldSets(); } } }
@Override public LocalProperties computeLocalProperties(LocalProperties in1, LocalProperties in2) { // uniqueness becomes grouping with streamed nested loops if ((in1.getGroupedFields() == null || in1.getGroupedFields().size() == 0) && in1.getUniqueFields() != null && in1.getUniqueFields().size() > 0) { return LocalProperties.forGrouping(in1.getUniqueFields().iterator().next().toFieldList()); } else { return in1.clearUniqueFieldSets(); } } }
public boolean groupsFields(FieldSet fields) { if (fields.size() > this.indexes.size()) { return false; } for (int i = 0; i < fields.size(); i++) { if (!fields.contains(this.indexes.get(i))) { return false; } } return true; }