ensure that only one limit is used on query (#1221)

This commit is contained in:
Brandon Pereira 2025-10-06 08:51:37 -06:00 committed by GitHub
parent 62eddcf20a
commit b68a4c9b16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 32 additions and 18 deletions

View file

@ -0,0 +1,6 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/app": patch
---
Tweak getMapKeys to leverage one row limiting implementation

View file

@ -559,10 +559,16 @@ const DBSearchPageFiltersComponent = ({
usePinnedFilters(sourceId ?? null);
const { width, startResize } = useResizable(16, 'left');
const { data: jsonColumns } = useJsonColumns(tcFromChartConfig(chartConfig));
const { data, isLoading, error } = useAllFields(
tcFromChartConfig(chartConfig),
);
const { data: jsonColumns } = useJsonColumns({
databaseName: chartConfig.from.databaseName,
tableName: chartConfig.from.tableName,
connectionId: chartConfig.connection,
});
const { data, isLoading, error } = useAllFields({
databaseName: chartConfig.from.databaseName,
tableName: chartConfig.from.tableName,
connectionId: chartConfig.connection,
});
const { data: source } = useSource({ id: sourceId });
const { data: tableMetadata } = useTableMetadata(tcFromSource(source));

View file

@ -280,8 +280,9 @@ describe('Metadata', () => {
expect(mockClickhouseClient.query).toHaveBeenCalledWith(
expect.objectContaining({
clickhouse_settings: {
max_rows_to_read: String(3e6),
read_overflow_mode: 'break',
max_rows_to_read: '0',
timeout_overflow_mode: 'break',
max_execution_time: 15,
},
}),
);
@ -312,8 +313,9 @@ describe('Metadata', () => {
expect(mockClickhouseClient.query).toHaveBeenCalledWith(
expect.objectContaining({
clickhouse_settings: {
max_rows_to_read: String(3e6),
read_overflow_mode: 'break',
max_rows_to_read: '0',
timeout_overflow_mode: 'break',
max_execution_time: 15,
},
}),
);

View file

@ -313,12 +313,12 @@ export class Metadata {
query_params: sql.params,
connectionId,
clickhouse_settings: {
max_rows_to_read: String(
this.getClickHouseSettings().max_rows_to_read ??
DEFAULT_METADATA_MAX_ROWS_TO_READ,
),
read_overflow_mode: 'break',
...this.getClickHouseSettings(),
// Max 15 seconds to get keys
timeout_overflow_mode: 'break',
max_execution_time: 15,
// Set the value to 0 (unlimited) so that the LIMIT is used instead
max_rows_to_read: '0',
},
})
.then(res => res.json<Record<string, unknown>>())
@ -642,12 +642,12 @@ export class Metadata {
connectionId: chartConfig.connection,
clickhouse_settings: !disableRowLimit
? {
max_rows_to_read: String(
this.getClickHouseSettings().max_rows_to_read ??
DEFAULT_METADATA_MAX_ROWS_TO_READ,
),
read_overflow_mode: 'break',
...this.getClickHouseSettings(),
// Max 15 seconds to get keys
timeout_overflow_mode: 'break',
max_execution_time: 15,
// Set the value to 0 (unlimited) so that the LIMIT is used instead
max_rows_to_read: '0',
}
: undefined,
})