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

GH-37726: [Swift][FlightSQL] Update behavior to be similar to existing impls #37764

Merged
merged 1 commit into from
Oct 26, 2023

Conversation

abandy
Copy link
Contributor

@abandy abandy commented Sep 17, 2023

Swift Flight implementation behavior didn't match existing flight implementations. The updates in this PR have been tested against python/examples/flight/server.py except for getSchemaTest and doExchangeTest which are not implemented in server.py. I will follow up this PR with a cleanup refactoring PR.

This difference in behavior was found due to issue #37726.

@github-actions
Copy link

Thanks for opening a pull request!

If this is not a minor PR. Could you open an issue for this pull request on GitHub? https://github.com/apache/arrow/issues/new/choose

Opening GitHub issues ahead of time contributes to the Openness of the Apache Arrow project.

Then could you also rename the pull request title in the following format?

GH-${GITHUB_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

or

MINOR: [${COMPONENT}] ${SUMMARY}

In the case of PARQUET issues on JIRA the title also supports:

PARQUET-${JIRA_ISSUE_ID}: [${COMPONENT}] ${SUMMARY}

See also:

@abandy abandy changed the title 37726: [Swift] Update flight behavior to be similar to existing impls GH-37726: [Swift] Update flight behavior to be similar to existing impls Sep 17, 2023
@github-actions
Copy link

⚠️ GitHub issue #37726 has been automatically assigned in GitHub to PR creator.

@abandy abandy marked this pull request as ready for review September 19, 2023 13:23
@abandy abandy requested a review from kou as a code owner September 19, 2023 13:23
@abandy
Copy link
Contributor Author

abandy commented Sep 19, 2023

Hi @kou, I apologize for the large review. These changes are for a fix found in the attached issue. I plan to follow up this change with a PR that will fix formatting issues (planning to use swiftlint )

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

How about using the following steps instead of "merging this PR without SwiftLint and applying SwiftLint with a separated PR"?

  1. PR1: Add a lint CI job
  2. PR2: Rebase this PR on main after PR1 is merged
    • Formatted changes are easier to review
  3. PR3: Add Swift to our integration test targets:

BTW, could you add a list of changed behavior in the description of this PR? It seems that no response cases are changed.

@@ -200,4 +201,41 @@ public class ArrowReader {
return .failure(.unknownError("Error loading file: \(error)"))
}
}

static public func MakeArrowReaderResult() -> ArrowReaderResult{
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
static public func MakeArrowReaderResult() -> ArrowReaderResult{
static public func MakeArrowReaderResult() -> ArrowReaderResult {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do


Copy link
Member

Choose a reason for hiding this comment

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

Are this trailing spaces change and other similar changes intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't too concerned with these style changes as I was going to follow up with a swiftlint PR. Since we are planning on running swiftlint on the code as a prior PR to this one, then these will be resolved (should be) when swiftlint is run against the files.

Comment on lines 51 to 62
for rc in recordBatchs {
switch writer.toMessage(rc) {
Copy link
Member

Choose a reason for hiding this comment

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

rc -> rb ("R"ecord "B"atch) or rc -> recordBatch may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

Copy link
Member

Choose a reason for hiding this comment

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

@abandy Could you check this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, will update, thanks!

descriptor = FlightDescriptor(flightData.flightDescriptor)
switch reader.fromMessage(dataHeader, dataBody: dataBody, result: result) {
case .success(()):
if(result.batches.count > 0 ) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(result.batches.count > 0 ) {
if result.batches.count > 0 {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

}

func getFlightInfo(_ request: ArrowFlight.FlightDescriptor) async throws -> ArrowFlight.FlightInfo {
return ArrowFlight.FlightInfo(Data())
let key = String(decoding: request.cmd, as: UTF8.self)
if(flights[key] != nil) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if(flights[key] != nil) {
if flights[key] != nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

Comment on lines 205 to 220
XCTAssertEqual(actionResults.count, 1)
XCTAssertEqual(String(bytes:actionResults[0].body, encoding: .utf8), "test_action result")
XCTAssertEqual(actionResults.count, 0)
Copy link
Member

Choose a reason for hiding this comment

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

It seems that this removes a test case for a DoAction that returns a result.
Is it intentional?

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 intentional but I will put test case back.

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting review Awaiting review labels Sep 19, 2023
@abandy
Copy link
Contributor Author

abandy commented Sep 21, 2023

How about using the following steps instead of "merging this PR without SwiftLint and applying SwiftLint with a separated PR"?

  1. PR1: Add a lint CI job

  2. PR2: Rebase this PR on main after PR1 is merged

    • Formatted changes are easier to review
  3. PR3: Add Swift to our integration test targets:

BTW, could you add a list of changed behavior in the description of this PR? It seems that no response cases are changed.

Sounds good, I will give this a go.

@abandy
Copy link
Contributor Author

abandy commented Oct 25, 2023

@kou please review when you get a chance, thank you!

@kou kou changed the title GH-37726: [Swift] Update flight behavior to be similar to existing impls GH-37726: [Swift][FlightSQL] Update behavior to be similar to existing impls Oct 25, 2023
@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting change review Awaiting change review labels Oct 25, 2023
@abandy abandy force-pushed the 37726 branch 2 times, most recently from 4736385 to 211fc12 Compare October 25, 2023 23:16
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Oct 25, 2023
Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

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

+1

@github-actions github-actions bot added awaiting merge Awaiting merge and removed awaiting change review Awaiting change review labels Oct 25, 2023
@kou
Copy link
Member

kou commented Oct 25, 2023

Oh, it seems that we still want to keep working on this PR.

@abandy
Copy link
Contributor Author

abandy commented Oct 25, 2023

@kou I had found that I had missed the requested change to revert the doActionTest and updated accordingly. The PR is now ready. I apologize for any confusion.

@kou
Copy link
Member

kou commented Oct 26, 2023

OK. I'll merge this.

@kou kou merged commit f2995b0 into apache:main Oct 26, 2023
6 checks passed
@kou kou removed the awaiting merge Awaiting merge label Oct 26, 2023
@abandy
Copy link
Contributor Author

abandy commented Oct 26, 2023

thank you!

@conbench-apache-arrow
Copy link

After merging your PR, Conbench analyzed the 6 benchmarking runs that have been run so far on merge-commit f2995b0.

There were no benchmark performance regressions. 🎉

The full Conbench report has more details.

loicalleyne pushed a commit to loicalleyne/arrow that referenced this pull request Nov 13, 2023
…xisting impls (apache#37764)

Swift Flight implementation behavior didn't match existing flight implementations.  The updates in this PR have been tested against python/examples/flight/server.py except for getSchemaTest and doExchangeTest which are not implemented in server.py.  I will follow up this PR with a cleanup refactoring PR.

This difference in behavior was found due to issue apache#37726.  
* Closes: apache#37726

Authored-by: Alva Bandy <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
dgreiss pushed a commit to dgreiss/arrow that referenced this pull request Feb 19, 2024
…xisting impls (apache#37764)

Swift Flight implementation behavior didn't match existing flight implementations.  The updates in this PR have been tested against python/examples/flight/server.py except for getSchemaTest and doExchangeTest which are not implemented in server.py.  I will follow up this PR with a cleanup refactoring PR.

This difference in behavior was found due to issue apache#37726.  
* Closes: apache#37726

Authored-by: Alva Bandy <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
@abandy abandy deleted the 37726 branch April 2, 2024 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Swift][FlightSQL] Processing valid RecordBatch leads to invalid offset from body's data.
2 participants