Skip to content

Conversation

@NobiGo
Copy link
Contributor

@NobiGo NobiGo commented Dec 26, 2025

No description provided.

int thresholdValue = ((BigDecimal) value).intValue();
closer.add(Prepare.THREAD_INSUBQUERY_THRESHOLD.push(thresholdValue));
}
if (propertyName.equals("trimfields")) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what I don't understand is "at which point during compilation is field trimming executed"?
The result will depend on the optimizations that are executed before and after.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The field trimmer is executed in two phases: the first one occurs after the SQL is converted into a Rel, and the second one takes place during the optimization of the RelNode.

Copy link
Member

@xiedeyantu xiedeyantu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look fine, only one small problem remains.

if (propertyName.equals("trimfields")) {
final boolean b = value instanceof Boolean
&& (Boolean) value;
closer.add(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be the same issue as with Mihai: will there be two places in the entire process where Trimer is performed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The field trimmer occurs twice.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a question that might not be directly related to the PR: why is column pruning necessary in both phases?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first fields trimmer occurs after the SQL is converted into a RelNode. At this stage, the RelNode should be simplified before optimization, making subsequent optimization plans more lightweight. The second fields trimmer happens during or after optimization—during this phase, certain columns may no longer be needed. For example, a condition like (age <> 5 OR age = 5) can be directly simplified to True, allowing the age column to be eliminated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your detailed explanation. We'll wait and see if @mihaibudiu has any further comments; if not, I think you can merge them anytime.

@NobiGo NobiGo merged commit 02c176a into apache:main Dec 28, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants