Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move WindowNode and JoinNode variations to the SPI #23976

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rschlussel
Copy link
Contributor

@rschlussel rschlussel commented Nov 7, 2024

Description

Move WindowNode, JoinNode, SemiJoinNode, MergeJoinNode, and SpatialJoinNode to the SPI

Motivation and Context

This change is required for using these nodes in plugin PlanCheckers and ConnectorPlanOptimizers. See e.g. discussion here #23596 (comment).

Impact

WindowNode, JoinNode, SemiJoinNode, MergeJoinNode, and SpatialJoinNode are added to the SPI. ConnectorJoinNode is removed from the SPI

Test Plan

CI

Contributor checklist

  • Please make sure your submission complies with our development, formatting, commit message, and attribution guidelines.
  • PR description addresses the issue accurately and concisely. If the change is non-trivial, a GitHub Issue is referenced.
  • Documented new properties (with its default value), SQL syntax, functions, or other functionality.
  • If release notes are required, they follow the release notes guidelines.
  • Adequate tests were added if applicable.
  • CI passed.

Release Notes

Please follow release notes guidelines and fill in the release notes below.

== RELEASE NOTES ==

SPI Changes
* Add WindowNode, JoinNode, SemiJoinNode, MergeJoinNode, and SpatialJoinNode to the SPI. :pr:`23976`
* Remove ConnectorJoinNode from the SPI. JoinNode can now be used instead. :pr:`23976`

@rschlussel rschlussel force-pushed the window-join-spi branch 6 times, most recently from 1ce43fa to bcaa7c9 Compare November 7, 2024 22:08
@steveburnett
Copy link
Contributor

Thanks for the release note entry! Just a nit.

== RELEASE NOTES ==

SPI Changes
* Add WindowNode, JoinNode, SemiJoinNode, and SpatialJoinNode to the SPI. :pr:`23976`

@rschlussel
Copy link
Contributor Author

sorry don't review yet. I changed the protocol files directly, and I need to generate them instead.

@rschlussel rschlussel force-pushed the window-join-spi branch 2 times, most recently from ecd0ab5 to 9b61627 Compare November 8, 2024 16:16
@rschlussel
Copy link
Contributor Author

this should be ready for review now. thanks!

Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @rschlussel for these changes.

Copy link
Contributor

@feilong-liu feilong-liu left a comment

Choose a reason for hiding this comment

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

Overall lgtm!
Just for usage of ImmutableMap/ImmutableSet I am not sure if we are relying on the order preserving property here, if yes, it will be better if we change it to LinkedHashMap/LinkedHashSet.

this.filter = filter;
this.leftHashVariable = leftHashVariable;
this.rightHashVariable = rightHashVariable;
this.distributionType = distributionType;
this.dynamicFilters = ImmutableMap.copyOf(dynamicFilters);
this.dynamicFilters = unmodifiableMap(new HashMap<>(dynamicFilters));
Copy link
Contributor

Choose a reason for hiding this comment

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

Should it be using LinkedHashMap to preserve order, which was guaranteed by ImmutableMap?

.addAll(right.getOutputVariables())
.build();

Set<VariableReferenceExpression> inputSymbols = new HashSet<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

LinkedHashSet to keep original order?


this.source = source;
this.prePartitionedInputs = ImmutableSet.copyOf(prePartitionedInputs);
this.prePartitionedInputs = unmodifiableSet(new HashSet<>(prePartitionedInputs));
Copy link
Contributor

Choose a reason for hiding this comment

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

LinkedHashSet?

this.specification = specification;
this.windowFunctions = ImmutableMap.copyOf(windowFunctions);
this.windowFunctions = unmodifiableMap(new HashMap<>(windowFunctions));
Copy link
Contributor

Choose a reason for hiding this comment

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

LinkedHashMap?

}

public Set<VariableReferenceExpression> getCreatedVariable()
{
return windowFunctions.keySet();
return unmodifiableSet(windowFunctions.keySet());
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need change here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

you're right, not needed. I wasn't sure if the set view of the unmodifiable map would also be unmodifiable, but it is.

@rschlussel rschlussel force-pushed the window-join-spi branch 2 times, most recently from 904e3c0 to 622e0aa Compare November 11, 2024 17:13
feilong-liu
feilong-liu previously approved these changes Nov 11, 2024
aditi-pandit
aditi-pandit previously approved these changes Nov 12, 2024
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @rschlussel. LGTM for native changes. Have a minor nit in the rest of the code.

@@ -11,18 +11,30 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.sql.planner.plan;

Copy link
Contributor

Choose a reason for hiding this comment

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

The license is repeated twice. Please delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks! fixed

Move the above plan nodes to the SPI so that they can be used by plugin
PlanCheckers.
With JoinNode moved to the SPI, ConnectorJoinNode is no longer
necessary.  Remove it and replace references with JoinNode.
Copy link
Contributor

@aditi-pandit aditi-pandit left a comment

Choose a reason for hiding this comment

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

Thanks @rschlussel LGTM for native changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants