Skip to content

Commit

Permalink
typelevel#385 - docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-twiner committed Jun 6, 2023
1 parent 154c65a commit a898e50
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dataset/src/test/scala/frameless/JoinTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class JoinTests extends TypedDatasetSuite {
check(forAll(prop[Int, Long, String]((leftDs, rightDs) => leftDs
.join(rightDs).full(leftDs.col('a) === rightDs.col('a))) _))
check(forAll(prop[Int, Long, String]((leftDs, rightDs) => leftDs
.join(rightDs).full(_.col('a) === rightDs.col('a))) _))
.join(rightDs).full(_('a) === rightDs.col('a))) _))
check(forAll(prop[Int, Long, String]((leftDs, rightDs) => leftDs
.join(rightDs).full(_.col('a) === _.col('a))) _))
}
Expand Down
24 changes: 24 additions & 0 deletions docs/FeatureOverview.md
Original file line number Diff line number Diff line change
Expand Up @@ -646,6 +646,30 @@ withCityInfo.select(
).as[AptPriceCity].show().run
```

### Chained Joins

Joins may be chained using the ChainedJoinOps:

```scala mdoc
import frameless.syntax.ChainedJoinSyntax

val withBedroomInfo = aptTypedDs.join(citiInfoTypedDS).inner { aptTypedDs('city) === citiInfoTypedDS('name) }
.join(bedroomStats).left { currentDs => currentDs.col('_1).field('city) === bedroomStats('city)}

withBedroomInfo.show().run()
```

you may also use a version that provides the joined dataset as an additional parameter to the condition function.

```scala mdoc
import frameless.syntax.ChainedJoinSyntax

val withBedroomInfoBothSidesAsParameters = aptTypedDs.join(citiInfoTypedDS).inner { aptTypedDs('city) === citiInfoTypedDS('name) }
.join(bedroomStats).left { (currentDs, joinedDs) => currentDs('_1).field('city) === joinedDs('city)}

withBedroomInfoBothSidesAsParameters.show().run()
```

```scala mdoc:invisible
spark.stop()
```

0 comments on commit a898e50

Please sign in to comment.