You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@impala.apache.org by "Paul Rogers (JIRA)" <ji...@apache.org> on 2018/11/05 21:10:00 UTC

[jira] [Created] (IMPALA-7807) Analysis test fixture to enable deeper testing

Paul Rogers created IMPALA-7807:
-----------------------------------

             Summary: Analysis test fixture to enable deeper testing
                 Key: IMPALA-7807
                 URL: https://issues.apache.org/jira/browse/IMPALA-7807
             Project: IMPALA
          Issue Type: Improvement
          Components: Frontend
    Affects Versions: Impala 3.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers


The Impala front-end provides a number of JUnit tests such as {{ExprRewriteRulesTest}}. These tests verify rewrites by providing layers of functions that build up a query, analyze the query, run rewrite rules, and test one part of the result.

The tests are fine as far as they go, but they do not cover all cases. For example, they tests rewrites in the {{SELECT}} clause, but not {{ORDER BY}} or {{GROUP BY}}. (Testing of those uncovered previously hidden bugs.) In some cases, we want to test rewrite rules in detail, but the existing tests only support a wholesale rewrite.

Since the existing tests are function based, it is hard to inject new behavior somewhere in the process, for example, to test the {{WHERE}} clause rather than {{SELECT}} To do that, we need to copy the {{SELECT}} functions, and make changes to test {{WHERE}}.

Since copying of code is generally an undesirable approach, a better approach is to use a "test fixture": a class that performs the required steps, maintains intermediate state for inspection, and acts as the foundation for various kinds of tests (such as the various clauses mentioned above.)

In practice, all that is required is moving some code from functions on the test class to be methods on a fixture class, which also holds onto state that would otherwise be lost in function calls.





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)