IMPALA-5038: Fix file size regex to include bytes There is a regex to remove file sizes from test logs to avoid diffs caused by changes in file headers, etc. The regex was detecting size=number correctly, but it does not include the byte unit (i.e. size=900B is distinct from size=900KB). A file size change introduced by IMPALA-4624 caused a diff because the file size changed from 900B to 1.1KB. This fixes the regex to include the byte unit, so that changes of this form do not cause diffs.
Change-Id: I5f7b8480065a4da63c8abaf53aae8aef772f0172 Reviewed-on: http://gerrit.cloudera.org:8080/6288 Reviewed-by: Marcel Kornacker <[email protected]> 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/c4fb67c9 Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/c4fb67c9 Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/c4fb67c9 Branch: refs/heads/master Commit: c4fb67c98c44c28f0c375b11a5ef996a2c52bbb2 Parents: 64c7f5b Author: Joe McDonnell <[email protected]> Authored: Tue Mar 7 09:15:14 2017 -0800 Committer: Impala Public Jenkins <[email protected]> Committed: Wed Mar 8 01:07:27 2017 +0000 ---------------------------------------------------------------------- fe/src/test/java/org/apache/impala/testutil/TestUtils.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/c4fb67c9/fe/src/test/java/org/apache/impala/testutil/TestUtils.java ---------------------------------------------------------------------- diff --git a/fe/src/test/java/org/apache/impala/testutil/TestUtils.java b/fe/src/test/java/org/apache/impala/testutil/TestUtils.java index e3e5798..ce93984 100644 --- a/fe/src/test/java/org/apache/impala/testutil/TestUtils.java +++ b/fe/src/test/java/org/apache/impala/testutil/TestUtils.java @@ -85,17 +85,18 @@ public class TestUtils { new PathFilter("file: ") }; - // File size could vary from run to run. For example, parquet file header size could - // change if Impala version changes. That doesn't mean anything wrong with the plan - // so we want to filter file size out. + // File size could vary from run to run. For example, the parquet file header size + // or column metadata size could change if the Impala version changes. That doesn't + // mean anything is wrong with the plan, so we want to filter the file size out. static class FileSizeFilter implements ResultFilter { + private final static String BYTE_FILTER = "[KMGT]?B"; private final static String NUMBER_FILTER = "\\d+(\\.\\d+)?"; private final static String FILTER_KEY = "size="; public boolean matches(String input) { return input.contains(FILTER_KEY); } public String transform(String input) { - return input.replaceAll(FILTER_KEY + NUMBER_FILTER, FILTER_KEY); + return input.replaceAll(FILTER_KEY + NUMBER_FILTER + BYTE_FILTER, FILTER_KEY); } }
