You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2017/05/04 02:10:37 UTC
[3/5] incubator-impala git commit: IMPALA-5262:
test_analytic_order_by_random fails with assert
IMPALA-5262: test_analytic_order_by_random fails with assert
This was a poorly written test that relies on assumptions about
the behavior of 'rand' and the order that rows get processed in
a table that Impala doesn't actually guarantee.
The new version is still sensitive to the precise behavior of
'rand()', but shouldn't be flaky unless that behavior is changed.
Change-Id: If1ba8154c2b6a8d508916d85391b95885ef915a9
Reviewed-on: http://gerrit.cloudera.org:8080/6775
Reviewed-by: Alex Behm <al...@cloudera.com>
Tested-by: Impala Public Jenkins
Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/698f4a34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/698f4a34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/698f4a34
Branch: refs/heads/master
Commit: 698f4a34c612985df9ffcf9a9a666ee6c38c5679
Parents: 5803a0b
Author: Thomas Tauber-Marshall <tm...@cloudera.com>
Authored: Mon May 1 16:13:40 2017 -0700
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Wed May 3 01:19:58 2017 +0000
----------------------------------------------------------------------
tests/query_test/test_sort.py | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/698f4a34/tests/query_test/test_sort.py
----------------------------------------------------------------------
diff --git a/tests/query_test/test_sort.py b/tests/query_test/test_sort.py
index 1b77b6f..b048c9f 100644
--- a/tests/query_test/test_sort.py
+++ b/tests/query_test/test_sort.py
@@ -188,10 +188,8 @@ class TestRandomSort(ImpalaTestSuite):
def test_analytic_order_by_random(self):
"""Tests that a window function over 'order by random()' works as expected."""
- # Since we use the same random seed and a very small table, the following queries
- # should be equivalent.
- results = transpose_results(self.execute_query("select id from "
- "functional.alltypestiny order by random(2)").data)
- analytic_results = transpose_results(self.execute_query("select last_value(id) over "
- "(order by random(2)) from functional.alltypestiny").data)
- assert results == analytic_results
+ # Since we use the same random seed, the results should be returned in order.
+ query = """select last_value(rand(2)) over (order by rand(2)) from
+ functional.alltypestiny"""
+ results = transpose_results(self.execute_query(query).data, lambda x: float(x))
+ assert (results == sorted(results))