@Test public void testCross() throws Exception { Embedding l1 = new Embedding(); l1.add(v0, PropertyValue.create("Foobar")); l1.add(e0, PropertyValue.create(42)); l1.add(v1); Embedding l2 = new Embedding(); l2.add(e1, PropertyValue.create("Foobar")); l2.add(e2, PropertyValue.create(42)); l2.add(e3); DataSet<Embedding> left = getExecutionEnvironment().fromElements(l1, l2); Embedding r1 = new Embedding(); r1.add(v2, PropertyValue.create("Baz")); r1.add(e1); Embedding r2 = new Embedding(); r2.add(v0, PropertyValue.create("Baz")); r2.add(e2); DataSet<Embedding> right = getExecutionEnvironment().fromElements(r1, r2); PhysicalOperator join = new CartesianProduct( left, right, 2, Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), Lists.newArrayList(), CrossOperatorBase.CrossHint.OPTIMIZER_CHOOSES ); DataSet<Embedding> result = join.evaluate(); assertEquals(4, result.count()); assertEveryEmbedding(result, embedding -> embedding.getProperties().equals(Lists.newArrayList( PropertyValue.create("Foobar"), PropertyValue.create(42), PropertyValue.create("Baz") ) )); assertEmbeddingExists(result, v0, e0, v1, v2, e1); assertEmbeddingExists(result, v0, e0, v1, v0, e2); assertEmbeddingExists(result, e1, e2, e3, v2, e1); assertEmbeddingExists(result, e1, e2, e3, v0, e2); }
@Override public DataSet<Embedding> evaluate() { return left.cross(right) .flatMap(new MergeEmbeddings( rightColumns, Lists.newArrayListWithCapacity(0), distinctVertexColumnsLeft, distinctVertexColumnsRight, distinctEdgeColumnsLeft, distinctEdgeColumnsRight )) .name(getName()); }
CartesianProduct implements PhysicalOperator { @Override public DataSet<Embedding> evaluate() { return left.cross(right) .flatMap(new MergeEmbeddings( rightColumns, Lists.newArrayListWithCapacity(0), distinctVertexColumnsLeft, distinctVertexColumnsRight, distinctEdgeColumnsLeft, distinctEdgeColumnsRight )) .name(getName()); } }
CartesianProduct implements PhysicalOperator { @Override public DataSet<Embedding> evaluate() { return left.cross(right) .flatMap(new MergeEmbeddings( rightColumns, Lists.newArrayListWithCapacity(0), distinctVertexColumnsLeft, distinctVertexColumnsRight, distinctEdgeColumnsLeft, distinctEdgeColumnsRight )) .name(getName()); } CartesianProduct(
    DataSet<Embedding> left,
    DataSet<Embedding> right,
    int rightColumns,
    List<Integer> distinctVertexColumnsLeft,
    List<Integer> distinctVertexColumnsRight,
    List<Integer> distinctEdgeColumnsLeft,
    List<Integer> distinctEdgeColumnsRight,
    CrossOperatorBase.CrossHint crossHint); }
CartesianProduct implements PhysicalOperator { @Override public DataSet<Embedding> evaluate() { return left.cross(right) .flatMap(new MergeEmbeddings( rightColumns, Lists.newArrayListWithCapacity(0), distinctVertexColumnsLeft, distinctVertexColumnsRight, distinctEdgeColumnsLeft, distinctEdgeColumnsRight )) .name(getName()); } CartesianProduct(
    DataSet<Embedding> left,
    DataSet<Embedding> right,
    int rightColumns,
    List<Integer> distinctVertexColumnsLeft,
    List<Integer> distinctVertexColumnsRight,
    List<Integer> distinctEdgeColumnsLeft,
    List<Integer> distinctEdgeColumnsRight,
    CrossOperatorBase.CrossHint crossHint); @Override DataSet<Embedding> evaluate(); @Override void setName(String newName); @Override String getName(); }
CartesianProduct implements PhysicalOperator { @Override public DataSet<Embedding> evaluate() { return left.cross(right) .flatMap(new MergeEmbeddings( rightColumns, Lists.newArrayListWithCapacity(0), distinctVertexColumnsLeft, distinctVertexColumnsRight, distinctEdgeColumnsLeft, distinctEdgeColumnsRight )) .name(getName()); } CartesianProduct(
    DataSet<Embedding> left,
    DataSet<Embedding> right,
    int rightColumns,
    List<Integer> distinctVertexColumnsLeft,
    List<Integer> distinctVertexColumnsRight,
    List<Integer> distinctEdgeColumnsLeft,
    List<Integer> distinctEdgeColumnsRight,
    CrossOperatorBase.CrossHint crossHint); @Override DataSet<Embedding> evaluate(); @Override void setName(String newName); @Override String getName();  }