Repository: vaexio/vaex (python)

Issue:
ds.join with how='right' automatically sets inplace=True
For how='right', inplace is apparently automatically activated.
Using inplace=False does not alter this anymore.
I guess this is a small bug.

ds1.join(ds2, left_on='a', right_on='b', how='right', inplace=False)
returns:

\# | b | y | a | x
-- | -- | -- | -- | --
0 | 'a' | 1 | 'a' | 1
1 | 'b' | 4 | 'b' | 2
2 | 'd' | 9 | masked | masked

For:
ds1

\# | a | x
-- | -- | --
0 | 'a' | 1
1 | 'b' | 2
2 | 'c' | 3

and 
ds2

\# | b | y
-- | -- | --
0 | 'a' | 1
1 | 'b' | 4
2 | 'd' | 9



Pull request description:
fix(core,join): inplace was not respected fow how=right
Fixes #95

Patch:
diff --git a/packages/vaex-core/vaex/dataframe.py b/packages/vaex-core/vaex/dataframe.py
index 3ba90a45..b55ec4df 100644
--- a/packages/vaex-core/vaex/dataframe.py
+++ b/packages/vaex-core/vaex/dataframe.py
@@ -4957,23 +4957,21 @@ class DataFrameLocal(DataFrame):
         :param inplace: {inplace}
         :return:
         """
-        ds = self if inplace else self.copy()
         inner = False
+        left = self
+        right = other
         if how == 'left':
-            left = ds
-            right = other
+            pass
         elif how == 'right':
-            left = other
-            right = ds
+            left, right = right, left
             lprefix, rprefix = rprefix, lprefix
             lsuffix, rsuffix = rsuffix, lsuffix
             left_on, right_on = right_on, left_on
         elif how == 'inner':
-            left = ds
-            right = other
             inner = True
         else:
             raise ValueError('join type not supported: {}, only left and right'.format(how))
+        left = left if inplace else left.copy()
 
         for name in right:
             if name in left and rprefix + name + rsuffix == lprefix + name + lsuffix:
@@ -4997,7 +4995,7 @@ class DataFrameLocal(DataFrame):
                 else:
                     left.add_column(right_name, right.columns[name])
         else:
-            df = ds
+            df = left
             # we index the right side, this assumes right is smaller in size
             index = right._index(right_on)
             lookup = np.zeros(left._length_original, dtype=np.int64)


Test patch:
diff --git a/tests/join_test.py b/tests/join_test.py
index c3e4b506..c89f2559 100644
--- a/tests/join_test.py
+++ b/tests/join_test.py
@@ -94,6 +94,7 @@ def test_right_x_x():
     assert df.evaluate('x_r').tolist() == [2, 1, 0]
     assert df.evaluate('y').tolist() == [2, None, 0]
     assert df.evaluate('y_r').tolist() == [None, 1, 2]
+    assert 'y_r' not in df_b
 
 
 def test_left_dup():