You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "Steve Carlin (Jira)" <ji...@apache.org> on 2026/07/10 22:55:00 UTC
[jira] [Updated] (IMPALA-14723) Calcite planner: Refactor TestReduceExprShuttle
[ https://issues.apache.org/jira/browse/IMPALA-14723?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Steve Carlin updated IMPALA-14723:
----------------------------------
Summary: Calcite planner: Refactor TestReduceExprShuttle (was: Calcite planner: Refactor TReduceExprShuttle)
> Calcite planner: Refactor TestReduceExprShuttle
> -----------------------------------------------
>
> Key: IMPALA-14723
> URL: https://issues.apache.org/jira/browse/IMPALA-14723
> Project: IMPALA
> Issue Type: Sub-task
> Reporter: Steve Carlin
> Priority: Major
>
> From code review:
> This is not really related to this change and doesn't need to happen in this specific review. I think the code would benefit from a helper function. The collection of fields in ReduceShuttleObjects would be local variables in the helper function, and the tests wouldn't know about them at all. For example (I haven't compiled this, so it probably needs a couple fixes):
> void verifyExprReduction(String expr, Map<String, TColumn> reductionMap, List<String> expectedReducedExprs) {
> CalciteAnalysisResult analysisResult =
> (CalciteAnalysisResult) parseAndAnalyze("SELECT " + query,
> feFixture_.createAnalysisCtx(), new CalciteCompilerFactory());
> CalciteRelNodeConverter relNodeConverter =
> new CalciteRelNodeConverter(analysisResult);
> RelNode rootNode = relNodeConverter.convert(analysisResult.getValidatedNode());
> Preconditions.checkState(rootNode instanceof Project);
> Project project = (Project) rootNode;
> Analyzer analyzer = analysisResult.getAnalyzer();
> TQueryCtx queryCtx = analyzer.getQueryCtx();
> TestReducerTmp testReducer = new TestReducerTmp(reductionMap);
> RexExecutor executor = new ImpalaRexExecutor(
> analyzer, queryCtx, testReducer);
> RexBuilder rexBuilder = new RexBuilder(
> new JavaTypeFactoryImpl(new ImpalaTypeSystemImpl()));
> List<RexNode> reducedExprs = new ArrayList<>();
> executor.reduce(rexBuilder, project.getProjects(), reducedExprs);
> assertEquals(expectedReducedExprs.size(), reducedExprs.size());
> for (int i = 0; i < expectedReducedExprs.size(); i++) {
> assertEquals(exectedReducedExprs.get(i), reducedExprs.get(i).toString());
> }
> }
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org