org.apache.flink.api.common.operators.base.CoGroupOperatorBase Java Examples
The following examples show how to use
org.apache.flink.api.common.operators.base.CoGroupOperatorBase.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoGroupNode.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
private List<OperatorDescriptorDual> initializeDataProperties(Partitioner<?> customPartitioner) { Ordering groupOrder1 = null; Ordering groupOrder2 = null; CoGroupOperatorBase<?, ?, ?, ?> cgc = getOperator(); groupOrder1 = cgc.getGroupOrderForInputOne(); groupOrder2 = cgc.getGroupOrderForInputTwo(); if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) { groupOrder1 = null; } if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) { groupOrder2 = null; } CoGroupDescriptor descr = new CoGroupDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2); if (customPartitioner != null) { descr.setCustomPartitioner(customPartitioner); } return Collections.<OperatorDescriptorDual>singletonList(descr); }
Example #2
Source File: CoGroupNode.java From flink with Apache License 2.0 | 6 votes |
private List<OperatorDescriptorDual> initializeDataProperties(Partitioner<?> customPartitioner) { Ordering groupOrder1 = null; Ordering groupOrder2 = null; CoGroupOperatorBase<?, ?, ?, ?> cgc = getOperator(); groupOrder1 = cgc.getGroupOrderForInputOne(); groupOrder2 = cgc.getGroupOrderForInputTwo(); if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) { groupOrder1 = null; } if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) { groupOrder2 = null; } CoGroupDescriptor descr = new CoGroupDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2); if (customPartitioner != null) { descr.setCustomPartitioner(customPartitioner); } return Collections.<OperatorDescriptorDual>singletonList(descr); }
Example #3
Source File: CoGroupNode.java From flink with Apache License 2.0 | 6 votes |
private List<OperatorDescriptorDual> initializeDataProperties(Partitioner<?> customPartitioner) { Ordering groupOrder1 = null; Ordering groupOrder2 = null; CoGroupOperatorBase<?, ?, ?, ?> cgc = getOperator(); groupOrder1 = cgc.getGroupOrderForInputOne(); groupOrder2 = cgc.getGroupOrderForInputTwo(); if (groupOrder1 != null && groupOrder1.getNumberOfFields() == 0) { groupOrder1 = null; } if (groupOrder2 != null && groupOrder2.getNumberOfFields() == 0) { groupOrder2 = null; } CoGroupDescriptor descr = new CoGroupDescriptor(this.keys1, this.keys2, groupOrder1, groupOrder2); if (customPartitioner != null) { descr.setCustomPartitioner(customPartitioner); } return Collections.<OperatorDescriptorDual>singletonList(descr); }
Example #4
Source File: CoGroupNode.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public CoGroupNode(CoGroupOperatorBase<?, ?, ?, ?> operator) { super(operator); this.dataProperties = initializeDataProperties(operator.getCustomPartitioner()); }
Example #5
Source File: CoGroupNodeTest.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
@Test public void testGetSemanticProperties() { DualInputSemanticProperties origProps = new DualInputSemanticProperties(); // props for first input origProps.addForwardedField(0, 0, 1); origProps.addForwardedField(0, 2, 2); origProps.addForwardedField(0, 3, 4); origProps.addForwardedField(0, 6, 0); origProps.addReadFields(0, new FieldSet(0, 2, 4, 7)); // props for second input origProps.addForwardedField(1, 1, 2); origProps.addForwardedField(1, 2, 8); origProps.addForwardedField(1, 3, 7); origProps.addForwardedField(1, 6, 6); origProps.addReadFields(1, new FieldSet(1, 3, 4)); CoGroupOperatorBase<?,?,?,?> op = mock(CoGroupOperatorBase.class); when(op.getSemanticProperties()).thenReturn(origProps); when(op.getKeyColumns(0)).thenReturn(new int[]{3,2}); when(op.getKeyColumns(1)).thenReturn(new int[]{6,3}); when(op.getParameters()).thenReturn(new Configuration()); CoGroupNode node = new CoGroupNode(op); SemanticProperties filteredProps = node.getSemanticPropertiesForLocalPropertyFiltering(); // check first input props assertTrue(filteredProps.getForwardingTargetFields(0, 0).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(0, 2).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 2).contains(2)); assertTrue(filteredProps.getForwardingTargetFields(0, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 3).contains(4)); assertTrue(filteredProps.getForwardingTargetFields(0, 6).size() == 0); assertTrue(filteredProps.getForwardingSourceField(0, 1) < 0); assertTrue(filteredProps.getForwardingSourceField(0, 2) == 2); assertTrue(filteredProps.getForwardingSourceField(0, 4) == 3); assertTrue(filteredProps.getForwardingSourceField(0, 0) < 0); // check second input props assertTrue(filteredProps.getReadFields(0).size() == 4); assertTrue(filteredProps.getReadFields(0).contains(0)); assertTrue(filteredProps.getReadFields(0).contains(2)); assertTrue(filteredProps.getReadFields(0).contains(4)); assertTrue(filteredProps.getReadFields(0).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 1).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 2).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 3).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 6).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 6).contains(6)); assertTrue(filteredProps.getForwardingSourceField(1, 2) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 8) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 7) == 3); assertTrue(filteredProps.getForwardingSourceField(1, 6) == 6); assertTrue(filteredProps.getReadFields(1).size() == 3); assertTrue(filteredProps.getReadFields(1).contains(1)); assertTrue(filteredProps.getReadFields(1).contains(3)); assertTrue(filteredProps.getReadFields(1).contains(4)); }
Example #6
Source File: CoGroupNode.java From flink with Apache License 2.0 | 4 votes |
public CoGroupNode(CoGroupOperatorBase<?, ?, ?, ?> operator) { super(operator); this.dataProperties = initializeDataProperties(operator.getCustomPartitioner()); }
Example #7
Source File: CoGroupNodeTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testGetSemanticProperties() { DualInputSemanticProperties origProps = new DualInputSemanticProperties(); // props for first input origProps.addForwardedField(0, 0, 1); origProps.addForwardedField(0, 2, 2); origProps.addForwardedField(0, 3, 4); origProps.addForwardedField(0, 6, 0); origProps.addReadFields(0, new FieldSet(0, 2, 4, 7)); // props for second input origProps.addForwardedField(1, 1, 2); origProps.addForwardedField(1, 2, 8); origProps.addForwardedField(1, 3, 7); origProps.addForwardedField(1, 6, 6); origProps.addReadFields(1, new FieldSet(1, 3, 4)); CoGroupOperatorBase<?,?,?,?> op = mock(CoGroupOperatorBase.class); when(op.getSemanticProperties()).thenReturn(origProps); when(op.getKeyColumns(0)).thenReturn(new int[]{3,2}); when(op.getKeyColumns(1)).thenReturn(new int[]{6,3}); when(op.getParameters()).thenReturn(new Configuration()); CoGroupNode node = new CoGroupNode(op); SemanticProperties filteredProps = node.getSemanticPropertiesForLocalPropertyFiltering(); // check first input props assertTrue(filteredProps.getForwardingTargetFields(0, 0).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(0, 2).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 2).contains(2)); assertTrue(filteredProps.getForwardingTargetFields(0, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 3).contains(4)); assertTrue(filteredProps.getForwardingTargetFields(0, 6).size() == 0); assertTrue(filteredProps.getForwardingSourceField(0, 1) < 0); assertTrue(filteredProps.getForwardingSourceField(0, 2) == 2); assertTrue(filteredProps.getForwardingSourceField(0, 4) == 3); assertTrue(filteredProps.getForwardingSourceField(0, 0) < 0); // check second input props assertTrue(filteredProps.getReadFields(0).size() == 4); assertTrue(filteredProps.getReadFields(0).contains(0)); assertTrue(filteredProps.getReadFields(0).contains(2)); assertTrue(filteredProps.getReadFields(0).contains(4)); assertTrue(filteredProps.getReadFields(0).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 1).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 2).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 3).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 6).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 6).contains(6)); assertTrue(filteredProps.getForwardingSourceField(1, 2) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 8) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 7) == 3); assertTrue(filteredProps.getForwardingSourceField(1, 6) == 6); assertTrue(filteredProps.getReadFields(1).size() == 3); assertTrue(filteredProps.getReadFields(1).contains(1)); assertTrue(filteredProps.getReadFields(1).contains(3)); assertTrue(filteredProps.getReadFields(1).contains(4)); }
Example #8
Source File: CoGroupNode.java From flink with Apache License 2.0 | 4 votes |
public CoGroupNode(CoGroupOperatorBase<?, ?, ?, ?> operator) { super(operator); this.dataProperties = initializeDataProperties(operator.getCustomPartitioner()); }
Example #9
Source File: CoGroupNodeTest.java From flink with Apache License 2.0 | 4 votes |
@Test public void testGetSemanticProperties() { DualInputSemanticProperties origProps = new DualInputSemanticProperties(); // props for first input origProps.addForwardedField(0, 0, 1); origProps.addForwardedField(0, 2, 2); origProps.addForwardedField(0, 3, 4); origProps.addForwardedField(0, 6, 0); origProps.addReadFields(0, new FieldSet(0, 2, 4, 7)); // props for second input origProps.addForwardedField(1, 1, 2); origProps.addForwardedField(1, 2, 8); origProps.addForwardedField(1, 3, 7); origProps.addForwardedField(1, 6, 6); origProps.addReadFields(1, new FieldSet(1, 3, 4)); CoGroupOperatorBase<?,?,?,?> op = mock(CoGroupOperatorBase.class); when(op.getSemanticProperties()).thenReturn(origProps); when(op.getKeyColumns(0)).thenReturn(new int[]{3,2}); when(op.getKeyColumns(1)).thenReturn(new int[]{6,3}); when(op.getParameters()).thenReturn(new Configuration()); CoGroupNode node = new CoGroupNode(op); SemanticProperties filteredProps = node.getSemanticPropertiesForLocalPropertyFiltering(); // check first input props assertTrue(filteredProps.getForwardingTargetFields(0, 0).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(0, 2).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 2).contains(2)); assertTrue(filteredProps.getForwardingTargetFields(0, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(0, 3).contains(4)); assertTrue(filteredProps.getForwardingTargetFields(0, 6).size() == 0); assertTrue(filteredProps.getForwardingSourceField(0, 1) < 0); assertTrue(filteredProps.getForwardingSourceField(0, 2) == 2); assertTrue(filteredProps.getForwardingSourceField(0, 4) == 3); assertTrue(filteredProps.getForwardingSourceField(0, 0) < 0); // check second input props assertTrue(filteredProps.getReadFields(0).size() == 4); assertTrue(filteredProps.getReadFields(0).contains(0)); assertTrue(filteredProps.getReadFields(0).contains(2)); assertTrue(filteredProps.getReadFields(0).contains(4)); assertTrue(filteredProps.getReadFields(0).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 1).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 2).size() == 0); assertTrue(filteredProps.getForwardingTargetFields(1, 3).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 3).contains(7)); assertTrue(filteredProps.getForwardingTargetFields(1, 6).size() == 1); assertTrue(filteredProps.getForwardingTargetFields(1, 6).contains(6)); assertTrue(filteredProps.getForwardingSourceField(1, 2) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 8) < 0); assertTrue(filteredProps.getForwardingSourceField(1, 7) == 3); assertTrue(filteredProps.getForwardingSourceField(1, 6) == 6); assertTrue(filteredProps.getReadFields(1).size() == 3); assertTrue(filteredProps.getReadFields(1).contains(1)); assertTrue(filteredProps.getReadFields(1).contains(3)); assertTrue(filteredProps.getReadFields(1).contains(4)); }
Example #10
Source File: CoGroupNode.java From Flink-CEPplus with Apache License 2.0 | 2 votes |
/** * Gets the operator for this CoGroup node. * * @return The CoGroup operator. */ @Override public CoGroupOperatorBase<?, ?, ?, ?> getOperator() { return (CoGroupOperatorBase<?, ?, ?, ?>) super.getOperator(); }
Example #11
Source File: CoGroupNode.java From flink with Apache License 2.0 | 2 votes |
/** * Gets the operator for this CoGroup node. * * @return The CoGroup operator. */ @Override public CoGroupOperatorBase<?, ?, ?, ?> getOperator() { return (CoGroupOperatorBase<?, ?, ?, ?>) super.getOperator(); }
Example #12
Source File: CoGroupNode.java From flink with Apache License 2.0 | 2 votes |
/** * Gets the operator for this CoGroup node. * * @return The CoGroup operator. */ @Override public CoGroupOperatorBase<?, ?, ?, ?> getOperator() { return (CoGroupOperatorBase<?, ?, ?, ?>) super.getOperator(); }