You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2018/04/11 11:42:17 UTC
spark git commit: [SPARK-23847][FOLLOWUP][PYTHON][SQL] Actually test
[desc|acs]_nulls_[first|last] functions in PySpark
Repository: spark
Updated Branches:
refs/heads/master 7c7570d46 -> c7622befd
[SPARK-23847][FOLLOWUP][PYTHON][SQL] Actually test [desc|acs]_nulls_[first|last] functions in PySpark
## What changes were proposed in this pull request?
There was a mistake in `tests.py` missing `assertEquals`.
## How was this patch tested?
Fixed tests.
Author: hyukjinkwon <gu...@apache.org>
Closes #21035 from HyukjinKwon/SPARK-23847.
Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c7622bef
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c7622bef
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c7622bef
Branch: refs/heads/master
Commit: c7622befdadfea725797d76e820e3dfc76fec927
Parents: 7c7570d
Author: hyukjinkwon <gu...@apache.org>
Authored: Wed Apr 11 19:42:09 2018 +0800
Committer: hyukjinkwon <gu...@apache.org>
Committed: Wed Apr 11 19:42:09 2018 +0800
----------------------------------------------------------------------
python/pyspark/sql/tests.py | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/spark/blob/c7622bef/python/pyspark/sql/tests.py
----------------------------------------------------------------------
diff --git a/python/pyspark/sql/tests.py b/python/pyspark/sql/tests.py
index dd04ffb..96c2a77 100644
--- a/python/pyspark/sql/tests.py
+++ b/python/pyspark/sql/tests.py
@@ -2991,19 +2991,23 @@ class SQLTests(ReusedSQLTestCase):
os.environ['TZ'] = orig_env_tz
time.tzset()
- def test_2_4_functions(self):
+ def test_sort_with_nulls_order(self):
from pyspark.sql import functions
df = self.spark.createDataFrame(
[('Tom', 80), (None, 60), ('Alice', 50)], ["name", "height"])
- df.select(df.name).orderBy(functions.asc_nulls_first('name')).collect()
- [Row(name=None), Row(name=u'Alice'), Row(name=u'Tom')]
- df.select(df.name).orderBy(functions.asc_nulls_last('name')).collect()
- [Row(name=u'Alice'), Row(name=u'Tom'), Row(name=None)]
- df.select(df.name).orderBy(functions.desc_nulls_first('name')).collect()
- [Row(name=None), Row(name=u'Tom'), Row(name=u'Alice')]
- df.select(df.name).orderBy(functions.desc_nulls_last('name')).collect()
- [Row(name=u'Tom'), Row(name=u'Alice'), Row(name=None)]
+ self.assertEquals(
+ df.select(df.name).orderBy(functions.asc_nulls_first('name')).collect(),
+ [Row(name=None), Row(name=u'Alice'), Row(name=u'Tom')])
+ self.assertEquals(
+ df.select(df.name).orderBy(functions.asc_nulls_last('name')).collect(),
+ [Row(name=u'Alice'), Row(name=u'Tom'), Row(name=None)])
+ self.assertEquals(
+ df.select(df.name).orderBy(functions.desc_nulls_first('name')).collect(),
+ [Row(name=None), Row(name=u'Tom'), Row(name=u'Alice')])
+ self.assertEquals(
+ df.select(df.name).orderBy(functions.desc_nulls_last('name')).collect(),
+ [Row(name=u'Tom'), Row(name=u'Alice'), Row(name=None)])
class HiveSparkSubmitTests(SparkSubmitTests):
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org