Uploaded image for project: 'IMPALA'
  2. IMPALA-7807

Analysis test fixture to enable deeper testing

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments


    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: Impala 3.0
    • Fix Version/s: Impala 3.2.0
    • Component/s: Frontend
    • Labels:
    • Epic Color:


      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.




            • Assignee:
              Paul.Rogers Paul Rogers
              Paul.Rogers Paul Rogers


              • Created:

                Issue deployment