Skip to content

Instantly share code, notes, and snippets.

@manishkkatoch
Created January 1, 2019 17:09
Show Gist options
  • Save manishkkatoch/688f16f57d43665c14b9c7e9fe327618 to your computer and use it in GitHub Desktop.
Save manishkkatoch/688f16f57d43665c14b9c7e9fe327618 to your computer and use it in GitHub Desktop.
Sugar class for providing basic join language
class JoinDataSet[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String)
object JoinDataSet {
def apply[L, R](lhs: Dataset[L], rhs: Dataset[R], joinType: String) = new JoinDataSet(lhs, rhs, joinType)
def leftJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "leftOuter")
def rightJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "rightOuter")
def fullOuterJoin[L, R](lhs: Dataset[L], rhs: Dataset[R]) = JoinDataSet(lhs, rhs, "fullOuter")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment