Skip to content

Conversation

@xiedeyantu
Copy link
Member

@xiedeyantu xiedeyantu marked this pull request as draft November 26, 2025 15:42
/** Returns a list (one element per input) of {@link ImmutableBitSet}s
* listing ordinals of input fields used by this node; the default
* implementation returns empty sets. */
default List<ImmutableBitSet> getInputFieldsUsed() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have a default at all?
Why not make it abstract?

Copy link
Member Author

@xiedeyantu xiedeyantu Nov 26, 2025

Choose a reason for hiding this comment

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

This draft was indeed not well-considered, and your comments are very useful to me. I will likely need to refactor this draft, and I will also address the questions Julian raised in Jira. Apologies, I'll mark it as not ready next time to save your review time.

return condition;
}

@Override public List<ImmutableBitSet> getInputFieldsUsed() {
Copy link
Contributor

Choose a reason for hiding this comment

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

The interpretation of this is open to debate.
All input fields are actually copied to the output.
Maybe this should be documented, and the method should be called getInputFieldsUsedInternally.

} else if (i < sys + leftCount + rightCount) {
rightB.set(i - sys - leftCount);
} else {
// out of range; ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

How is this possible?

@Override public List<ImmutableBitSet> getInputFieldsUsed() {
final ImmutableList.Builder<ImmutableBitSet> builder = ImmutableList.builder();
for (RelNode input : inputs) {
int fieldCount = input.getRowType().getFieldCount();
Copy link
Contributor

Choose a reason for hiding this comment

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

this should be the same for all inputs

return hints;
}

@Override public List<ImmutableBitSet> getInputFieldsUsed() {
Copy link
Contributor

Choose a reason for hiding this comment

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

same comment as for filter

@xiedeyantu
Copy link
Member Author

Sorry, it's still in draft form and not ready yet. Thank you very much for your comments—I'll carefully consider them.

@caicancai caicancai added the discussion-in-jira There's open discussion in JIRA to be resolved before proceeding with the PR label Nov 27, 2025
Copy link
Member

@caicancai caicancai left a comment

Choose a reason for hiding this comment

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

I noticed the email Julian sent; it seems we need to discuss this in an email.

@xiedeyantu
Copy link
Member Author

I noticed the email Julian sent; it seems we need to discuss this in an email.

Yes, I saw it. I replied in Jira. I think we should continue the discussion in Jira, email was just a temporary measure.


/**
* Metadata that identifies, per input, which fields (columns) of each
* input are referenced by a relational expression.
Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking that RexNode as a relational expression.
You have to be more precise.
Moreover, you have to define "referenced" -- see my question about filters, for example.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated the documentation. Could you please review whether the updated version aligns with your suggestions?

@mihaibudiu
Copy link
Contributor

I am not very sure how this will be used, but this looks fine.
You are not covering all existing RelNode types yet.

@xiedeyantu
Copy link
Member Author

I am not very sure how this will be used, but this looks fine. You are not covering all existing RelNode types yet.

This JIRA requirement originates from CALCITE-5740, aiming to more accurately determine which columns from child nodes are actually utilized by parent nodes, thereby facilitating the judgment of whether a conversion to semi-join is possible.

@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 1, 2025

@xiedeyantu xiedeyantu marked this pull request as ready for review December 1, 2025 23:28
@xiedeyantu
Copy link
Member Author

The requester of this PR has not provided a clear response, so it may be put on hold for an extended period.

@xiedeyantu
Copy link
Member Author

Hi @julianhyde, since you were the one who proposed this, could you please review this PR when you have time?

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

Labels

discussion-in-jira There's open discussion in JIRA to be resolved before proceeding with the PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants