Skip to content

feat: support multipart responses in query #1865

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

Merged
merged 31 commits into from
Feb 19, 2025
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a45a41a
feat: support multipart responses in query
astandrik Dec 23, 2024
1e1f769
fix: error
astandrik Feb 4, 2025
a2c7987
fix: use external parser
astandrik Feb 6, 2025
4a69540
fix: better code
astandrik Feb 6, 2025
6a7c469
fix: flat array
astandrik Feb 7, 2025
a8fb66c
fix: remove flushbatch
astandrik Feb 7, 2025
7a265ef
Revert "fix: remove flushbatch"
astandrik Feb 7, 2025
c396845
Revert "Revert "fix: remove flushbatch""
astandrik Feb 7, 2025
75477a1
Revert "Revert "Revert "fix: remove flushbatch"""
astandrik Feb 10, 2025
50cc0bd
fix: reducers
astandrik Feb 12, 2025
27a08a7
fix: speed up
astandrik Feb 12, 2025
42c46e4
fix: better code
astandrik Feb 12, 2025
b7f19aa
fix: better cancel
astandrik Feb 13, 2025
083b977
fix: better code
astandrik Feb 13, 2025
dbdce22
fix: move speed metrics to result sets
astandrik Feb 13, 2025
c49c843
fix: add flag
astandrik Feb 13, 2025
0e906e7
Merge branch 'main' into astandrik.stash-multipart
astandrik Feb 13, 2025
d23d7ea
fix: rm unused
astandrik Feb 13, 2025
73d9014
fix: truncated
astandrik Feb 13, 2025
46d6868
fix: better code
astandrik Feb 13, 2025
7b36f31
fix: interface shaking
astandrik Feb 13, 2025
e7d2685
fix: unit tests
astandrik Feb 13, 2025
d31ee4d
fix: speedMetrics -> streamMetrics
astandrik Feb 13, 2025
b123f4c
fix: const indices width
astandrik Feb 14, 2025
0155d50
fix: form-data
astandrik Feb 17, 2025
af06c3a
Merge branch 'main' into astandrik.stash-multipart
astandrik Feb 17, 2025
1a02250
fix: review fixes
astandrik Feb 17, 2025
e3e2fc5
Merge branch 'main' into astandrik.stash-multipart
astandrik Feb 17, 2025
2c1ab79
Merge branch 'main' into astandrik.stash-multipart
astandrik Feb 18, 2025
3513f77
fix: better code
astandrik Feb 18, 2025
cda5c96
fix: performance issues
astandrik Feb 19, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: form-data
  • Loading branch information
astandrik committed Feb 17, 2025
commit 0155d5027ad3adbd8f8db51a138e7af085745742
22 changes: 18 additions & 4 deletions src/services/api/streaming.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import {
import type {Actions, TracingLevel} from '../../types/api/query';
import type {QuerySyntax, StatisticsMode} from '../../types/store/query';
import type {QueryResponseChunk, SessionChunk, StreamDataChunk} from '../../types/store/streaming';
import {BINARY_DATA_IN_PLAIN_TEXT_DISPLAY} from '../../utils/constants';
import {
BINARY_DATA_IN_PLAIN_TEXT_DISPLAY,
DEV_ENABLE_TRACING_FOR_ALL_REQUESTS,
} from '../../utils/constants';
import {settingsManager} from '../settings';

import {BaseYdbAPI} from './base';
Expand Down Expand Up @@ -45,22 +48,33 @@ export class StreamingAPI extends BaseYdbAPI {
);

const queryParams = qs.stringify(
{...params, base64, schema: 'multipart'},
{timeout: params.timeout, base64, schema: 'multipart'},
{encoder: encodeURIComponent},
);

const body = {...params, base64, schema: 'multipart'};
const headers = new Headers({
Accept: 'multipart/x-mixed-replace',
Accept: 'multipart/form-data',
'Content-Type': 'application/json',
});

if (params.tracingLevel) {
headers.set('X-Trace-Verbosity', String(params.tracingLevel));
}

const enableTracing = settingsManager.readUserSettingsValue(
DEV_ENABLE_TRACING_FOR_ALL_REQUESTS,
);

if (enableTracing) {
headers.set('X-Want-Trace', '1');
}

const response = await fetch(`${this.getPath('/viewer/query')}?${queryParams}`, {
method: 'GET',
method: 'POST',
signal: options.signal,
headers,
body: JSON.stringify(body),
});

if (!response.ok) {
Expand Down
Loading