Skip to content

Conversation

@zoltan
Copy link
Contributor

@zoltan zoltan commented Nov 5, 2025

Currently when we translate a Presto plan to a Velox plan fragment, we do not have a way later on at the Velox layer to detect if a particular PartitionedOutputNode will be read by the coordinator as the final output of a plan or will be read by other workers.

This patch adds a new field to PartitionedOutputNode so we can signal this during plan translation inside Prestissimo.

In my particular case, This is needed to order to support exchange translation decisions in the cuDF exchange (coming in via a later PR), where the last PartitionedOutputNode has a single partition and will be read by the Presto coordinator, but all other PartitionedOutputNodes will be actually read by other workers via special, hardware accelerated Exchange. Without this change we have no way to distinguish these two at the pure Velox DriverAdapter translation level.

Currently when we translate a Presto plan to a Velox plan fragment, we
do not have a way later on at the Velox layer to detect if a
particular PartitionedOutputNode will be read by the coordinator as the
final output of a plan or will be read by other workers.

This patch adds a new field to PartitionedOutputNode so we can signal
this during plan translation inside Prestissimo.

In my particular case, This is needed to order to support exchange translation
decisions in the cuDF exchange (coming in via a later PR), where the
last PartitionedOutputNode has a single partition and will be read by
the Presto coordinator, but all other PartitionedOutputNodes will be
actually read by other workers via special, hardware accelerated
Exchange. Without this change we have no way to distinguish these two
at the pure Velox DriverAdapter translation level.
@netlify
Copy link

netlify bot commented Nov 5, 2025

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 9ebda67
🔍 Latest deploy log https://app.netlify.com/projects/meta-velox/deploys/690ae60c8db8d600082447de

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 5, 2025
@majetideepak majetideepak changed the title feat: enable PartitionedOutputNode to distinguish the root of a plan feat: PartitionedOutputNode must distinguish the root of a plan Nov 5, 2025
return outputType_;
}

const bool isRootFragment() const {
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to use const since the return is a scalar value here.
bool isRootFragment() const {
Similar to below
bool isPartitioned() const {

@majetideepak
Copy link
Collaborator

@mbasmanova, @xiaoxmeng, any thoughts on this API change?

@majetideepak
Copy link
Collaborator

On the Prestissimo side, the OutputNode is also mapped to the Velox PartitionedOutputNode. This field will help capture that information.
https://github.com/prestodb/presto/pull/26535/files

Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@zoltan It sounds like you want to introduce a new plan node: OutputNode. That node is a special case of PartitionedOutputNode: it must be the root node and must have "gather" semantic.

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants