Skip to content

Commit

Permalink
Fix empty map bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
kaka1992 committed May 5, 2015
1 parent 7e64d1e commit c54d904
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
3 changes: 0 additions & 3 deletions python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,9 +1334,6 @@ def cast(self, dataType):
def between(self, lowerBound, upperBound):
""" A boolean expression that is evaluated to true if the value of this
expression is between the given columns.
>>> df[df.col1.between(lowerBound, upperBound)].collect()
[Row(col1=5, col2=6, col3=8)]
"""
return (self >= lowerBound) & (self <= upperBound)

Expand Down
7 changes: 4 additions & 3 deletions python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,9 +439,10 @@ def test_rand_functions(self):
assert row[1] >= -4.0 and row[1] <= 4.0, "got: %s" % row[1]

def test_between_function(self):
df = self.sqlCtx.parallelize([Row(a=1, b=2, c=3),
Row(a=2, b=1, c=3),
Row(a=4, b=1, c=4)]).toDF()
df = self.sqlCtx.parallelize([
Row(a=1, b=2, c=3),
Row(a=2, b=1, c=3),
Row(a=4, b=1, c=4)]).toDF()
self.assertEqual([False, True, True],
df.select(df.a.between(df.b, df.c)).collect())

Expand Down

0 comments on commit c54d904

Please sign in to comment.