Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
margin-right: var(--g-spacing-2);
}

&__output-chunk-max-size {
width: 50%;
margin-right: var(--g-spacing-2);
}

&__pragmas {
width: 100%;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import type {QuerySettings} from '../../../../types/store/query';
import {cn} from '../../../../utils/cn';
import {
useQueryExecutionSettings,
useQueryStreamingSetting,
useSetting,
useTypedDispatch,
useTypedSelector,
Expand Down Expand Up @@ -84,6 +85,7 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm

const [useShowPlanToSvg] = useSetting<boolean>(SETTING_KEYS.USE_SHOW_PLAN_SVG);
const enableTracingLevel = useTracingLevelOptionAvailable();
const [isQueryStreamingEnabled] = useQueryStreamingSetting();

const timeout = watch('timeout');
const queryMode = watch('queryMode');
Expand Down Expand Up @@ -220,6 +222,39 @@ function QuerySettingsForm({initialValues, onSubmit, onClose}: QuerySettingsForm
/>
</div>
</Flex>
{isQueryStreamingEnabled && (
<Flex direction="row" alignItems="flex-start" className={b('dialog-row')}>
<label htmlFor="outputChunkMaxSize" className={b('field-title')}>
{QUERY_SETTINGS_FIELD_SETTINGS.outputChunkMaxSize.title}
</label>
<div className={b('control-wrapper')}>
<Controller
name="outputChunkMaxSize"
control={control}
render={({field}) => (
<TextInput
id="outputChunkMaxSize"
type="number"
{...field}
value={field.value?.toString()}
className={b('output-chunk-max-size')}
placeholder="1000000"
validationState={
errors.outputChunkMaxSize ? 'invalid' : undefined
}
errorMessage={errors.outputChunkMaxSize?.message}
errorPlacement="inside"
endContent={
<span className={b('postfix')}>
{i18n('form.output.chunk.max.size.bytes')}
</span>
}
/>
)}
/>
</div>
</Flex>
)}
<Flex direction="row" alignItems="flex-start" className={b('dialog-row')}>
<label htmlFor="pragmas" className={b('field-title')}>
{QUERY_SETTINGS_FIELD_SETTINGS.pragmas.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ export const QUERY_SETTINGS_FIELD_SETTINGS = {
limitRows: {
title: formI18n('form.limit-rows'),
},
outputChunkMaxSize: {
title: formI18n('form.output.chunk.max.size'),
},
pragmas: {
title: formI18n('form.pragmas'),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"form.statistics-mode": "Statistics collection mode",
"form.tracing-level": "Tracing level",
"form.limit-rows": "Limit rows",
"form.output.chunk.max.size": "Output chunk max size",
"form.output.chunk.max.size.bytes": "bytes",
"form.pragmas": "Pragmas",
"button-done": "Save",
"tooltip_plan-to-svg-statistics": "Statistics option is set to \"Full\" due to the enabled \"Execution plan\" experiment.\n To disable it, go to the \"Experiments\" section in the user settings.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"form.statistics-mode": "Режим сбора статистики",
"form.tracing-level": "Tracing level",
"form.limit-rows": "Лимит строк",
"form.output.chunk.max.size": "Максимальный размер чанка",
"form.output.chunk.max.size.bytes": "байт",
"form.pragmas": "Прагмы",
"tooltip_plan-to-svg-statistics": "Опция статистики установлена в значение \"Full\" из-за включенного эксперимента \"Execution plan\".\n Чтобы отключить его, перейдите в раздел \"Experiments\" в настройках пользователя.",
"button-done": "Готово",
Expand Down
5 changes: 3 additions & 2 deletions src/store/reducers/query/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ interface SendQueryParams extends QueryRequestParams {
// Stream query receives queryId from session chunk.
type StreamQueryParams = Omit<SendQueryParams, 'queryId'>;

const DEFAULT_STREAM_CHUNK_SIZE = 1000;
const DEFAULT_CONCURRENT_RESULTS = false;

export const queryApi = api.injectEndpoints({
Expand Down Expand Up @@ -192,7 +191,9 @@ export const queryApi = api.injectEndpoints({
timeout: isNumeric(querySettings.timeout)
? Number(querySettings.timeout) * 1000
: undefined,
output_chunk_max_size: DEFAULT_STREAM_CHUNK_SIZE,
output_chunk_max_size: isNumeric(querySettings.outputChunkMaxSize)
? Number(querySettings.outputChunkMaxSize)
: undefined,
concurrent_results: DEFAULT_CONCURRENT_RESULTS || undefined,
base64,
},
Expand Down
8 changes: 8 additions & 0 deletions src/utils/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,10 @@ export const querySettingsValidationSchema = z.object({
(val) => (val === '' ? undefined : val),
z.coerce.number().gt(0).lte(100_000).or(z.undefined()),
),
outputChunkMaxSize: z.preprocess(
(val) => (val === '' ? undefined : val),
z.coerce.number().int().positive().or(z.undefined()),
),
queryMode: queryModeSchema,
transactionMode: transactionModeSchema,
statisticsMode: statisticsModeSchema,
Expand All @@ -347,6 +351,10 @@ export const querySettingsRestoreSchema = z
(val) => (val === '' ? undefined : val),
z.coerce.number().gt(0).lte(100_000).optional().catch(DEFAULT_QUERY_SETTINGS.limitRows),
),
outputChunkMaxSize: z.preprocess(
(val) => (val === '' ? undefined : val),
z.coerce.number().int().positive().optional(),
),
queryMode: queryModeSchema.catch(DEFAULT_QUERY_SETTINGS.queryMode),
transactionMode: transactionModeSchema.catch(DEFAULT_QUERY_SETTINGS.transactionMode),
statisticsMode: statisticsModeSchema.catch(DEFAULT_QUERY_SETTINGS.statisticsMode),
Expand Down
Loading