Fang-Yu Rao has uploaded this change for review. ( http://gerrit.cloudera.org:8080/22346
Change subject: IMPALA-13653: Create hooks for Calcite planner in Frontend ...................................................................... IMPALA-13653: Create hooks for Calcite planner in Frontend This commit creates hooks into the Impala planner that will call into the Calcite planner. There is one factory hook and 3 compilation hooks introduced to allow this to happen: - ParsedStatementCreator: This factory hook has one method "create" which will create a ParsedStatement interface object. The idea is to introduce a query option that allows the Calcite objects to be called instead of the Impala planner. In this iteration, the only implementation called is the ParsedStatementCreatorImpl object which will instantiate a ParsedStatementImpl (next bullet point) - ParsedStatement: The implementation of this interface will parse the SQL query into an AST in its constructor. The implementation will be a wrapper for the AST which can be accessed through the "getTopLevelNode" method. For the current planner, the "StatementBase" object will be accessible via this method. The "getAnalysisDriver" method returns an AnalysisDriver object which is the next step in the compilation process. The implementation for the Impala planner can be found in the ParsedStatementImpl class. - AnalysisDriver: The implementation of this interface will analyze the parsed AST via the "analyze" method. To make the code review as easy as possible, the AnalyzeDriverImpl implementation has been placed inside the AnalysisContext object. The "createSingleNodePlanner" serves as a method to fetch the next interface hook, the "SingleNodePlannerIntf" object. One hack note here: If this were refactored properly, there should be no reason for the SingleNodePlannerIntf object to be stored in the AnalysisResult. It has been placed there to keep this code review simple. Some broader refactoring is needed to make this code cleaner. - SingleNodePlannerIntf: The implementation of this interface will take the AnalysisResult and return a PlanNode that can run on a single node via the "createSingleNodePlan" method. Various other methods in this interface allow access to data structures that are needed for the final plan. These objects are related to the output Expr objects. Again, while the hooks and the API could be made simpler, the decision for the methods chosen in the API were to keep the code review as simple as possible. Change-Id: I85dddceecfb70b85cc3887d19d5ba95e40b94e8e --- M fe/src/main/java/org/apache/impala/analysis/AnalysisContext.java A fe/src/main/java/org/apache/impala/analysis/AnalysisDriver.java A fe/src/main/java/org/apache/impala/analysis/ParsedStatement.java A fe/src/main/java/org/apache/impala/analysis/ParsedStatementCreator.java A fe/src/main/java/org/apache/impala/analysis/ParsedStatementCreatorImpl.java A fe/src/main/java/org/apache/impala/analysis/ParsedStatementImpl.java M fe/src/main/java/org/apache/impala/analysis/StmtMetadataLoader.java M fe/src/main/java/org/apache/impala/planner/Planner.java M fe/src/main/java/org/apache/impala/planner/SingleNodePlanner.java A fe/src/main/java/org/apache/impala/planner/SingleNodePlannerIntf.java M fe/src/main/java/org/apache/impala/service/Frontend.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriteRulesTest.java M fe/src/test/java/org/apache/impala/analysis/ExprRewriterTest.java M fe/src/test/java/org/apache/impala/analysis/ParserTest.java M fe/src/test/java/org/apache/impala/analysis/StmtMetadataLoaderTest.java M fe/src/test/java/org/apache/impala/common/FrontendFixture.java M fe/src/test/java/org/apache/impala/common/FrontendTestBase.java M fe/src/test/java/org/apache/impala/common/QueryFixture.java 18 files changed, 657 insertions(+), 230 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/46/22346/1 -- To view, visit http://gerrit.cloudera.org:8080/22346 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I85dddceecfb70b85cc3887d19d5ba95e40b94e8e Gerrit-Change-Number: 22346 Gerrit-PatchSet: 1 Gerrit-Owner: Fang-Yu Rao <[email protected]> Gerrit-Reviewer: Steve Carlin <[email protected]>
