pyflink.dataframe.DataFrame.join#
- DataFrame.join(other: pyflink.dataframe.dataframe.DataFrame, on: Optional[Union[str, pyflink.table.expression.Expression, List[str]]] = None, how: str = 'inner', left_on: Optional[Union[str, pyflink.table.expression.Expression, List[str]]] = None, right_on: Optional[Union[str, pyflink.table.expression.Expression, List[str]]] = None) pyflink.dataframe.dataframe.DataFrame[source]#
Join with another DataFrame.
- Parameters
other – Right DataFrame to join.
on – Join key(s) when both DataFrames have the same column names.
how – Join type. One of “inner”, “left”, “right”, “full”, “outer”.
left_on – Left join key(s).
right_on – Right join key(s).
- Returns
A new DataFrame with the join result.
- Example::
>>> df1.join(df2, on="id") >>> df1.join(df2, on=col('id') == col('user_id')) >>> df1.join(df2, left_on="id", right_on="user_id") >>> df1.join(df2, on=["id", "name"], how="left")
Note
When
on=is a column name (str or list of str) shared by both sides, the duplicate column is projected away in the result (pandas-style USING semantics). The same applies whenleft_onandright_onname the same column on both sides. Pass a booleanExpression(e.g.col('id') == col('d_id')) to keep both columns and skip the deduplication.