You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by jr...@apache.org on 2017/11/13 22:11:25 UTC

[4/6] incubator-impala git commit: IMPALA-6164: Fix stale query profile in TestAlwaysFalseFilter

IMPALA-6164: Fix stale query profile in TestAlwaysFalseFilter

TestAlwaysFalseFilter gets the query profile without fetching all the
rows, resulting in a stale query profile and failing the test. With
this patch all the rows are fetched before getting the query profile.
This is enough to get the final profile because the query profile
finalization is performed in Coordinator::GetNext after we hit eos.
A bug in Base64Decode related to query profile decoding is also fixed.
Currently Base64Decode may produce incorrect output length if the output
parameter is not initialized with 0.

Testing: TestAlwaysFalseFilter is run and passes 1000 times. It doesn't
pass 1000 times consecutively without this patch.

Change-Id: I04bb76d20541fa035d88167b593d1b8bc3873e89
Reviewed-on: http://gerrit.cloudera.org:8080/8498
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/fdf94a40
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/fdf94a40
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/fdf94a40

Branch: refs/heads/master
Commit: fdf94a400341c175943272d823b73d4b23f3919d
Parents: 2212a88
Author: Tianyi Wang <tw...@cloudera.com>
Authored: Mon Nov 6 16:36:50 2017 -0800
Committer: Impala Public Jenkins <im...@gerrit.cloudera.org>
Committed: Fri Nov 10 04:27:59 2017 +0000

----------------------------------------------------------------------
 be/src/util/coding-util.cc                       | 4 +++-
 tests/custom_cluster/test_always_false_filter.py | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/fdf94a40/be/src/util/coding-util.cc
----------------------------------------------------------------------
diff --git a/be/src/util/coding-util.cc b/be/src/util/coding-util.cc
index 78b9ebd..6a8ea2e 100644
--- a/be/src/util/coding-util.cc
+++ b/be/src/util/coding-util.cc
@@ -195,9 +195,11 @@ bool Base64DecodeBufLen(const char* in, int64_t in_len, int64_t* out_max) {
 
 bool Base64Decode(const char* in, int64_t in_len, int64_t out_max, char* out,
     int64_t* out_len) {
+  uint32_t out_len_u32 = 0;
   if (UNLIKELY((in_len & 3) != 0)) return false;
   const int decode_result = sasl_decode64(in, static_cast<unsigned>(in_len), out,
-      static_cast<unsigned>(out_max), reinterpret_cast<unsigned*>(out_len));
+      static_cast<unsigned>(out_max), &out_len_u32);
+  *out_len = out_len_u32;
   if (UNLIKELY(decode_result != SASL_OK || *out_len != out_max - 1)) return false;
   return true;
 }

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/fdf94a40/tests/custom_cluster/test_always_false_filter.py
----------------------------------------------------------------------
diff --git a/tests/custom_cluster/test_always_false_filter.py b/tests/custom_cluster/test_always_false_filter.py
index 461c128..e02c64a 100644
--- a/tests/custom_cluster/test_always_false_filter.py
+++ b/tests/custom_cluster/test_always_false_filter.py
@@ -42,13 +42,16 @@ class TestAlwaysFalseFilter(CustomClusterTestSuite):
     for table_suffix in ['_avro', '_rc', '_seq']:
       cursor.execute("use functional" + table_suffix)
       cursor.execute(query)
+      # Fetch all rows to finalize the query profile.
+      cursor.fetchall()
       profile = cursor.get_profile()
       assert re.search("Files rejected: [^0] \([^0]\)", profile) is None
       assert re.search("Splits rejected: [^0] \([^0]\)", profile) is None
     for table_suffix in ['', '_parquet']:
       cursor.execute("use functional" + table_suffix)
       cursor.execute(query)
+      # Fetch all rows to finalize the query profile.
+      cursor.fetchall()
       profile = cursor.get_profile()
       assert re.search("Files rejected: [^0] \([^0]\)", profile) is None
       assert re.search("Splits rejected: 8 \(8\)", profile) is not None
-