[ https://issues.apache.org/jira/browse/BEAM-4461?focusedWorklogId=205964&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-205964 ]
ASF GitHub Bot logged work on BEAM-4461: ---------------------------------------- Author: ASF GitHub Bot Created on: 28/Feb/19 19:10 Start Date: 28/Feb/19 19:10 Worklog Time Spent: 10m Work Description: reuvenlax commented on pull request #7353: [BEAM-4461] Support inner and outer style joins in CoGroup. URL: https://github.com/apache/beam/pull/7353#discussion_r261341606 ########## File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/transforms/CoGroup.java ########## @@ -107,156 +105,241 @@ * those fields match. In this case, fields must be specified for every input PCollection. For * example: * - * <pre>{@code PCollection<KV<Row, Row>> joined = PCollectionTuple - * .of(input1Tag, input1) - * .and(input2Tag, input2) + * <pre>{@code PCollection<KV<Row, Row>> joined + * = PCollectionTuple.of("input1Tag", input1, "input2Tag", input2) * .apply(CoGroup - * .byFieldNames(input1Tag, "referringUser")) - * .byFieldNames(input2Tag, "user")); + * .join("input1Tag", By.fieldNames("referringUser"))) + * .join("input2Tag", By.fieldNames("user"))); * }</pre> + * + * <p>Traditional (SQL) joins are cross-product joins. All rows that match the join condition are + * combined into individual rows and returned; in fact any SQL inner joins is a subset of the + * cross-product of two tables. This transform also supports the same functionality using the {@link + * Inner#crossProductJoin()} method. + * + * <p>For example, consider the SQL join: SELECT * FROM input1 INNER JOIN input2 ON input1.user = + * input2.user + * + * <p>You could express this with: + * + * <pre>{@code + * PCollection<Row> joined = PCollectionTuple.of("input1", input1, "input2", input2) + * .apply(CoGroup.join(By.fieldNames("user")).crossProductJoin(); + * }</pre> + * + * <p>The schema of the output PCollection contains a nested message for each of input1 and input2. + * Like above, you could use the {@link Convert} transform to convert it to the following POJO: + * + * <pre>{@code + * {@literal @}DefaultSchema(JavaFieldSchema.class) + * public class JoinedValue { + * public Input1Type input1; Review comment: fixed ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on 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: 205964) Time Spent: 22.5h (was: 22h 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: 22.5h > Remaining Estimate: 0h > > e.g. JoinBy(fields). Project, Filter, etc. -- This message was sent by Atlassian JIRA (v7.6.3#76005)