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

Only Check includeEndStreamAction in response header when needed #591

Merged
merged 19 commits into from
Oct 9, 2024

Conversation

linzhou-db
Copy link
Collaborator

@linzhou-db linzhou-db commented Oct 7, 2024

Only Check includeEndStreamAction in response header when needed:

  • for sync queryTable and queryTableChanges,
  • not for async queries and getTableVersion and getTableMetadata

@@ -336,7 +336,7 @@ class DeltaSharingRestClient(
val target = getTargetUrl(
s"/shares/$encodedShareName/schemas/$encodedSchemaName/tables/$encodedTableName/metadata" +
s"$encodedParams")
val response = getNDJson(target)
val response = getNDJson(target, requireVersion = true, checkEndStreamActionHeader = false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Question: do we set includeendstreamaction for metadata queries?
If do, would it be a problem if some DS server returns endStreamAction for it?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

makes sense, updated to not set includeendstreamaction for table version and metadata queries.

@@ -495,7 +500,9 @@ class DeltaSharingRestClient(
val (version, respondedFormat, lines, _) = getFilesByPage(table, target, request)
(version, respondedFormat, lines)
} else {
val response = getNDJson(target, request)
val response = getNDJsonPost(
target = target, data = request, setIncludeEndStreamAction = true
Copy link
Collaborator

Choose a reason for hiding this comment

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

(optional, for my readability)
consider renaming: includeEndStreamAction -> endStreamActionEnabled
We can then setIncludeEndStreamAction = endStreamActionEnabled where we are setting it to true, and then at other places only test for setIncludeEndStreamAction.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

do you mean the renaming of the header or variable name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

The variable name @linzhou-db

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated

@@ -871,14 +871,10 @@ class DeltaSharingRestClient(
0L
}
},
respondedFormat = respondedFormat,
includeEndStreamActionHeader = includeEndStreamActionHeader,
respondedFormat = getRespondedFormat(capabilities),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Optional optimization:
Can getResponse itself create the capabilitesMap to avoid duplicate parsing and map creation from capabilities, since it seems the capabilities map is what is used everywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated.

@linzhou-db linzhou-db merged commit f88f9aa into main Oct 9, 2024
10 checks passed
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.

2 participants