Skip to content

Commit 27484a0

Browse files
authored
refactor: use schema:multi for all query requests (#1399)
1 parent f8a0db1 commit 27484a0

File tree

34 files changed

+541
-279
lines changed

34 files changed

+541
-279
lines changed

src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopQueries.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function TopQueries({tenantName}: TopQueriesProps) {
4646
);
4747

4848
const loading = isFetching && currentData === undefined;
49-
const {result: data} = currentData || {};
49+
const data = currentData?.resultSets?.[0]?.result || [];
5050

5151
const handleRowClick = React.useCallback(
5252
(row: any) => {

src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/TopShards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export const TopShards = ({tenantName, path}: TopShardsProps) => {
3232
);
3333

3434
const loading = isFetching && currentData === undefined;
35-
const {result: data} = currentData || {};
35+
const data = currentData?.resultSets?.[0]?.result || [];
3636

3737
const columns = getTopShardsColumns(tenantName, location);
3838

src/containers/Tenant/Diagnostics/TenantOverview/TenantStorage/TopTables.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export function TopTables({path}: TopTablesProps) {
3232
);
3333
const loading = isFetching && currentData === undefined;
3434

35-
const {result: data} = currentData || {};
35+
const data = currentData?.resultSets?.[0]?.result || [];
3636

3737
const formatSize = (value?: number) => {
3838
const size = getSizeWithSignificantDigits(data?.length ? Number(data[0].Size) : 0, 0);

src/containers/Tenant/Diagnostics/TopQueries/RunningQueriesData.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,16 @@ interface Props {
2121
export const RunningQueriesData = ({database}: Props) => {
2222
const [autoRefreshInterval] = useAutoRefreshInterval();
2323
const filters = useTypedSelector((state) => state.executeTopQueries);
24-
const {
25-
currentData: data,
26-
isFetching,
27-
error,
28-
} = topQueriesApi.useGetRunningQueriesQuery(
24+
const {currentData, isFetching, error} = topQueriesApi.useGetRunningQueriesQuery(
2925
{
3026
database,
3127
filters,
3228
},
3329
{pollingInterval: autoRefreshInterval},
3430
);
3531

32+
const data = currentData?.resultSets?.[0].result || [];
33+
3634
return (
3735
<React.Fragment>
3836
{error ? <ResponseError error={parseQueryErrorToString(error)} /> : null}
@@ -41,7 +39,7 @@ export const RunningQueriesData = ({database}: Props) => {
4139
emptyDataMessage={i18n('no-data')}
4240
columnsWidthLSKey={RUNNING_QUERIES_COLUMNS_WIDTH_LS_KEY}
4341
columns={RUNNING_QUERIES_COLUMNS}
44-
data={data || []}
42+
data={data}
4543
settings={QUERY_TABLE_SETTINGS}
4644
/>
4745
</TableWithControlsLayout.Table>

src/containers/Tenant/Diagnostics/TopQueries/TopQueriesData.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const TopQueriesData = ({database, onRowClick}: Props) => {
3131
},
3232
{pollingInterval: autoRefreshInterval},
3333
);
34-
const {result: data} = currentData || {};
34+
const data = currentData?.resultSets?.[0]?.result || [];
3535

3636
const rawColumns = TOP_QUERIES_COLUMNS;
3737
const columns = rawColumns.map((column) => ({

src/containers/Tenant/Diagnostics/TopShards/TopShards.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export const TopShards = ({tenantName, path, type}: TopShardsProps) => {
120120
{pollingInterval: autoRefreshInterval},
121121
);
122122
const loading = isFetching && result === undefined;
123-
const {result: data} = result ?? {};
123+
const data = result?.resultSets?.[0]?.result || [];
124124

125125
const onSort = (newSortOrder?: SortOrder | SortOrder[]) => {
126126
// omit information about sort order to disable ASC order, only DESC makes sense for top shards

src/containers/Tenant/Query/ExecuteResult/ExecuteResult.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ export function ExecuteResult({
7272
const {error, isLoading, queryId, data} = result;
7373

7474
const stats: TKqpStatsQuery | undefined = data?.stats;
75-
const resultsSetsCount = data?.resultSets?.length;
76-
const isMulti = resultsSetsCount && resultsSetsCount > 0;
77-
const currentResult = isMulti ? data?.resultSets?.[selectedResultSet] : data;
75+
const resultsSetsCount = data?.resultSets?.length || 0;
76+
const currentResult = data?.resultSets?.[selectedResultSet];
7877
const {plan, simplifiedPlan} = React.useMemo(() => getPlan(data), [data]);
7978

8079
const resultOptions: ControlGroupOption<SectionID>[] = [
@@ -106,7 +105,7 @@ export function ExecuteResult({
106105
const renderResult = () => {
107106
return (
108107
<div className={b('result-wrapper')}>
109-
{isMulti && resultsSetsCount > 1 && (
108+
{resultsSetsCount > 1 && (
110109
<div>
111110
<Tabs
112111
className={b('result-tabs')}

src/containers/Tenant/Query/Preview/Preview.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export const Preview = ({database, path, type}: PreviewProps) => {
3030

3131
const [autoRefreshInterval] = useAutoRefreshInterval();
3232

33-
const query = `--!syntax_v1\nselect * from \`${path}\` limit 32`;
33+
const query = `select * from \`${path}\` limit 32`;
3434
const {currentData, isFetching, error} = previewApi.useSendQueryQuery(
3535
{database, query, action: isExternalTableType(type) ? 'execute-query' : 'execute-scan'},
3636
{
@@ -40,7 +40,7 @@ export const Preview = ({database, path, type}: PreviewProps) => {
4040
},
4141
);
4242
const loading = isFetching && currentData === undefined;
43-
const data = currentData ?? {};
43+
const data = currentData?.resultSets?.[0] ?? {};
4444

4545
const handleClosePreview = () => {
4646
dispatch(setShowPreview(false));

src/containers/Tenant/Query/QueryEditor/QueryEditor.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
DEFAULT_IS_QUERY_RESULT_COLLAPSED,
3131
DEFAULT_SIZE_RESULT_PANE_KEY,
3232
LAST_USED_QUERY_ACTION_KEY,
33-
QUERY_USE_MULTI_SCHEMA_KEY,
3433
} from '../../../../utils/constants';
3534
import {useEventHandler, useQueryExecutionSettings, useSetting} from '../../../../utils/hooks';
3635
import {useChangedQuerySettings} from '../../../../utils/hooks/useChangedQuerySettings';
@@ -105,7 +104,6 @@ function QueryEditor(props: QueryEditorProps) {
105104
useLastQueryExecutionSettings();
106105
const {resetBanner} = useChangedQuerySettings();
107106

108-
const [useMultiSchema] = useSetting(QUERY_USE_MULTI_SCHEMA_KEY);
109107
const [lastUsedQueryAction, setLastUsedQueryAction] = useSetting<QueryAction>(
110108
LAST_USED_QUERY_ACTION_KEY,
111109
);
@@ -148,8 +146,6 @@ function QueryEditor(props: QueryEditorProps) {
148146
const handleSendExecuteClick = useEventHandler((text?: string) => {
149147
const {input, history} = executeQuery;
150148

151-
const schema = useMultiSchema ? 'multi' : 'modern';
152-
153149
const query = text ?? input;
154150

155151
setLastUsedQueryAction(QUERY_ACTIONS.execute);
@@ -163,7 +159,6 @@ function QueryEditor(props: QueryEditorProps) {
163159
query,
164160
database: tenantName,
165161
querySettings,
166-
schema,
167162
enableTracingLevel,
168163
queryId,
169164
});

src/containers/UserSettings/i18n/en.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535

3636
"settings.showDomainDatabase.title": "Show domain database",
3737

38-
"settings.queryUseMultiSchema.title": "Allow queries with multiple result sets",
39-
"settings.queryUseMultiSchema.description": "Use 'multi' schema for queries. It enables queries with multiple result sets. It returns nothing on versions 23-3 and older",
40-
4138
"settings.useClusterBalancerAsBackend.title": "Use cluster balancer as backend",
4239
"settings.useClusterBalancerAsBackend.description": "By default random cluster node is used as backend. It causes saved links to become invalid after some time, when node is restarted. Using balancer as backend fixes it",
4340

0 commit comments

Comments
 (0)