Skip to content

[native] ArrowFlight connector missing ColumnHandle operator<()#24914

Merged
BryanCutler merged 1 commit intoprestodb:masterfrom
BryanCutler:arrow-flight-add-native-col-handle-operator
May 2, 2025
Merged

[native] ArrowFlight connector missing ColumnHandle operator<()#24914
BryanCutler merged 1 commit intoprestodb:masterfrom
BryanCutler:arrow-flight-add-native-col-handle-operator

Conversation

@BryanCutler
Copy link
Contributor

Description

ArrowColumnHandle was missing the operator<() in the protocol definition. This was causing queries that require ordering of columns to fail. A special definition of ArrowColumnHandle is required in the protocol to define the operator to order columns by the columnName.

Add a Java unit test to test the native ArrowFlight connector will support queries that require ordering of column names.

Fixed the error message to correctly insert the mustache template for the ColumnHandle class.

Motivation and Context

Queries using the ArrowFlight connector that require ordering of column names will fail with the error:

Query 20250414_191718_00006_9pc45 failed: Expected response code from http://127.0.0.1:7778/v1/task/20250414_191718_00006_9pc45.1.0.0.0?summarize to be 200, but was 500: 
missing operator<() in {class_name} subclass

Impact

NA

Test Plan

Added a Java e2e with a query that reproduces the error.

Contributor checklist

  • Please make sure your submission complies with our contributing guide, in particular code style and commit standards.
  • 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.

== NO RELEASE NOTE ==

@BryanCutler BryanCutler requested review from a team as code owners April 14, 2025 22:14
@BryanCutler BryanCutler requested a review from presto-oss April 14, 2025 22:14
@prestodb-ci prestodb-ci added the from:IBM PR from IBM label Apr 14, 2025
@prestodb-ci prestodb-ci requested review from a team, nishithakbhaskaran and pramodsatya and removed request for a team April 14, 2025 22:14
{{#comparable}}
virtual bool operator<(const {{&class_name}}& /* o */) const {
throw std::runtime_error("missing operator<() in {class_name} subclass");
throw std::runtime_error("missing operator<() in {{class_name}} subclass");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was causing the error message to display as missing operator<() in {class_name} subclass. The double braces are needed to correct it when generating the protocol.

Copy link
Contributor

@pramodsatya pramodsatya left a comment

Choose a reason for hiding this comment

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

Thanks @BryanCutler, LGTM.

};
void to_json(json& j, const ArrowColumnHandle& p);
void from_json(const json& j, ArrowColumnHandle& p);
} // namespace facebook::presto::protocol::arrow_flight No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Add newline at end

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 for catching that @pramodsatya! I added a newline and spacing to match the similar files from the other connectors, then generated the protocol.

@BryanCutler BryanCutler force-pushed the arrow-flight-add-native-col-handle-operator branch 3 times, most recently from c55f20f to 562c121 Compare April 21, 2025 17:15
@aditi-pandit
Copy link
Contributor

@BryanCutler : The code looks good. Can you combine your commits into a single one with the same titile as this PR ? Will approve then.

@BryanCutler BryanCutler force-pushed the arrow-flight-add-native-col-handle-operator branch from 562c121 to e97eeda Compare April 22, 2025 17:31
void from_json(const json& j, ArrowTransactionHandle& p);

} // namespace facebook::presto::protocol::arrow_flight
/*
Copy link
Contributor

@aditi-pandit aditi-pandit Apr 22, 2025

Choose a reason for hiding this comment

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

@BryanCutler Its strange this copyright message is inserted here again... It needs to be in the header only. Please can you fix it if possible.

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 special file ArrowColumnHandle.hpp.inc has a copyright header and when the protocol is generated it puts the entire file into presto_protocol_arrow_flight.h. It's the same thing for the Hive connector and all the *.inc files.
I thought it was a bit strange too, but it seems like the *.inc files need a header, so it's just the side effect.

Copy link
Contributor

Choose a reason for hiding this comment

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

We should fix this in the scripting. Please create an issue for 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.

Created issue for this at #25082

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 @BryanCutler

@BryanCutler BryanCutler force-pushed the arrow-flight-add-native-col-handle-operator branch from e97eeda to 3d5f6bd Compare April 29, 2025 17:57
ArrowColumnHandle was missing the operator<() in the protocol definition.
This was causing queries that require ordering of columns to fail. A special
definition of ArrowColumnHandle is required in the protocol to define
the operator to order columns by the columnName.

Add e2e test for ColumnHandle ordering

Add a Java unit test to test the native ArrowFlight connector will
support queries that require ordering of column names.
@BryanCutler BryanCutler force-pushed the arrow-flight-add-native-col-handle-operator branch from 3d5f6bd to ffe2bb0 Compare April 29, 2025 22:29
@BryanCutler
Copy link
Contributor Author

@beinan this is needed for the native Arrow connector and was missing from #24504, please take a look if you can, thanks!

@BryanCutler BryanCutler merged commit 4caf30f into prestodb:master May 2, 2025
105 checks passed
@BryanCutler BryanCutler deleted the arrow-flight-add-native-col-handle-operator branch May 2, 2025 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

from:IBM PR from IBM

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants