@Beta public interface AutoJoiner
JoinDefinition define(AutoJoinerContext context) {
JoinStage purchases = JoinStage.builder(context.getInputStages().get("purchases"))
.isRequired()
.build();
JoinStage users = JoinStage.builder(context.getInputStages().get("users"))
.isOptional()
.build();
JoinCondition condition = JoinCondition.onKeys()
.addKey(new JoinKey("users", Arrays.asList("id")))
.addKey(new JoinKey("purchases", Arrays.asList("user_id")))
.build();
return JoinDefinition.builder()
// stage name, field name, optional alias
.select(new Field("purchases", "id", "purchase_id"),
new Field("purchases", "user_id"),
new Field("users", "email"))
.from(purchases, users)
.on(condition)
.build()
}
Modifier and Type | Method and Description |
---|---|
JoinDefinition |
define(AutoJoinerContext context) |
@Nullable JoinDefinition define(AutoJoinerContext context)
Copyright © 2021 Cask Data, Inc. Licensed under the Apache License, Version 2.0.