[ 
https://issues.apache.org/jira/browse/BEAM-4461?focusedWorklogId=228058&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-228058
 ]

ASF GitHub Bot logged work on BEAM-4461:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 16/Apr/19 00:12
            Start Date: 16/Apr/19 00:12
    Worklog Time Spent: 10m 
      Work Description: reuvenlax commented on pull request #8273: [BEAM-4461] 
A transform to perform binary joins of PCollections with schemas
URL: https://github.com/apache/beam/pull/8273#discussion_r275588695
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/Join.java
 ##########
 @@ -0,0 +1,237 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.schemas.transforms;
+
+import javax.annotation.Nullable;
+import org.apache.beam.sdk.schemas.FieldAccessDescriptor;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.transforms.PTransform;
+import org.apache.beam.sdk.values.PCollection;
+import org.apache.beam.sdk.values.PCollectionTuple;
+import org.apache.beam.sdk.values.Row;
+
+/**
+ * A transform that performs equijoins across two schema {@link PCollection}s.
+ *
+ * <p>This transform allows joins between two input PCollections simply by 
specifying the fields to
+ * join on. The resulting {@code PCollection<Row>} will have two fields named 
"lhs" and "rhs"
+ * respectively, each with the schema of the corresponding input PCollection.
+ *
+ * <p>For example, the following demonstrates joining two PCollections using a 
natural join on the
+ * "user" and "country" fields, where both the left-hand and the right-hand 
PCollections have fields
+ * with these names.
+ *
+ * <pre>
+ * {@code PCollection<Row> joined = 
pCollection1.apply(Join.innerJoin(pCollection2).using("user", "country"));
+ * }</pre>
+ *
+ * <p>If the right-hand PCollection contains fields with different names to 
join against, you can
+ * specify them as follows:
+ *
+ * <pre>{@code PCollection<Row> joined = 
pCollection1.apply(Join.innerJoin(pCollection2)
+ *       .on(FieldsEqual.left("user", "country").right("otherUser", 
"otherCountry")));
+ * }</pre>
+ *
+ * <p>Full outer joins, left outer joins, and right outer joins are also 
supported.
+ */
+public class Join {
 
 Review comment:
   good catch! done.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 228058)
    Time Spent: 26.5h  (was: 26h 20m)

> Create a library of useful transforms that use schemas
> ------------------------------------------------------
>
>                 Key: BEAM-4461
>                 URL: https://issues.apache.org/jira/browse/BEAM-4461
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>              Labels: triaged
>          Time Spent: 26.5h
>  Remaining Estimate: 0h
>
> e.g. JoinBy(fields). Project, Filter, etc.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to