[
https://issues.apache.org/jira/browse/IMPALA-7807?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16722034#comment-16722034
]
ASF subversion and git services commented on IMPALA-7807:
---------------------------------------------------------
Commit 00f971eccb9ea8b1a79f42c90f8ea39eefd8f729 in impala's branch
refs/heads/master from [~paul-rogers]
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=00f971e ]
IMPALA-7807: Analysis test fixture
Refactors the existing ExprRewriteRulesTest to pull out the framework
functionality into a "test fixture" class which can be used for a
variety of tests. The fixture allows more variation, and access to
more intermediate state, than does the existing function-based
framework.
A "session fixture" tracks session-level state including default
options, database, user. Then a set of per-query fixtures provide
various levels of per-query functionality from parse-only, to normal
analysis and to special no-rewrite analysis.
The rewrite-specific version resides in the only test that needs it:
ExprRewriteRulesTest. The other, more general, versions reside in the
new test fixture class.
The fixture pulls in code from FrontEndBase to handle the low-level
tasks of running a query, and from ExprRewriteRulesTest for the
rewrite-specific aspects. For now, the FrontEndBase base class was
left unchanged. ExprRewriteRulesTest is refactored to use the new
fixture in order to illustrate usage of the test fixture.
The key value of this work is to allow greater detail when testing
future changes. In order to keep the refactoring as simple and clean,
no new test cases were added here.
Testing: since this is a test fixture, the refactored ExprRewriteRulesTest
implicitly tests the fixture code. No "production" (non-test) code was
changed in this patch.
Change-Id: Id69c99b284960f16394f61072d38dd00269bc10c
Reviewed-on: http://gerrit.cloudera.org:8080/11881
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>
> 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
> Priority: Minor
>
> 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)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]