Skip to content

Commit

Permalink
Inserted blank lines for PEP8 compliance
Browse files Browse the repository at this point in the history
  • Loading branch information
ksonj committed Mar 31, 2015
1 parent d81b02b commit ea66f3d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ def test_udf_with_callable(self):
d = [Row(number=i, squared=i**2) for i in range(10)]
rdd = self.sc.parallelize(d)
data = self.sqlCtx.createDataFrame(rdd)

class PlusFour:
def __call__(self, col):
if col is not None:
return col + 4

call = PlusFour()
pudf = UserDefinedFunction(call, LongType())
res = data.select(pudf(data['number']).alias('plus_four'))
Expand All @@ -133,9 +135,11 @@ def test_udf_with_partial_function(self):
d = [Row(number=i, squared=i**2) for i in range(10)]
rdd = self.sc.parallelize(d)
data = self.sqlCtx.createDataFrame(rdd)

def some_func(col, param):
if col is not None:
return col + param

pfunc = functools.partial(some_func, param=4)
pudf = UserDefinedFunction(pfunc, LongType())
res = data.select(pudf(data['number']).alias('plus_four'))
Expand Down

0 comments on commit ea66f3d

Please sign in to comment.