Skip to content

Conversation

ykmr1224
Copy link
Collaborator

@ykmr1224 ykmr1224 commented Oct 14, 2025

Description

  • Extract ProjectHandler from CalciteRelNodeVisitor
  • This is pure refactoring, and no logic change.
  • I will raise some more PRs to reduce the size of CalciteRelNodeVisitor

Related Issues

n/a

Check List

  • New functionality includes testing.
  • New functionality has been documented.
  • New functionality has javadoc added.
  • New functionality has a user manual doc added.
  • New PPL command checklist all confirmed.
  • API changes companion pull request created.
  • Commits are signed per the DCO using --signoff or -s.
  • Public documentation issue/PR created.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@ykmr1224 ykmr1224 added maintenance Improves code quality, but not the product backport 2.19-dev labels Oct 14, 2025
Signed-off-by: Tomoyuki Morita <moritato@amazon.com>
@LantaoJin
Copy link
Member

LantaoJin commented Oct 15, 2025

I will raise some more PRs to reduce the size of CalciteRelNodeVisitor

LGTM for Project. But I don't think the the size of CalciteRelNodeVisitor is a problem. Some methods can be shared in CalciteRelNodeVisitor. No need to create one handler per visit(). And small method sometimes is bad smell code. For example:

    if (isSingleAllFieldsProject(node)) {
      return handleAllFieldsProject(node, context);
    }

is confused.

    if ( node.getProjectList().size() == 1
        && node.getProjectList().getFirst() instanceof AllFields ) {
      return handleAllFieldsProject(node, context);
    }

looks better.

@ykmr1224
Copy link
Collaborator Author

I will raise some more PRs to reduce the size of CalciteRelNodeVisitor

LGTM for Project. But I don't think the the size of CalciteRelNodeVisitor is a problem. Some methods can be shared in CalciteRelNodeVisitor. No need to create one handler per visit(). And small method sometimes is bad smell code. For example:

I am not planning to extract all visitor to separate handlers. Just a few of them are huge and better extracted.
My main motivation is to control the context size for AI agent. It tend to fill up the context when touching CalciteRelNodeVisitor. Smaller context would improve AI agent's quality, even when it won't fill the context.

And small method sometimes is bad smell code.

isSingleAllFieldsProject is from before this change. And I think this kind of extraction is normally good one for readability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 2.19-dev maintenance Improves code quality, but not the product

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants