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
6 changes: 6 additions & 0 deletions .changeset/famous-yaks-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@hyperdx/common-utils": patch
"@hyperdx/app": patch
---

Tweak getMapKeys to leverage one row limiting implementation
14 changes: 10 additions & 4 deletions packages/app/src/components/DBSearchPageFilters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
10 changes: 6 additions & 4 deletions packages/common-utils/src/__tests__/metadata.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}),
);
Expand Down Expand Up @@ -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,
},
}),
);
Expand Down
20 changes: 10 additions & 10 deletions packages/common-utils/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Copy link
Member Author

Choose a reason for hiding this comment

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

@MikeShi42 you said "shorter query timeout" in the ticket- I guessed 15 seconds. Is this reasonable?

// Set the value to 0 (unlimited) so that the LIMIT is used instead
max_rows_to_read: '0',
Copy link
Contributor

Choose a reason for hiding this comment

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

you can probably set this to undefined instead

Copy link
Member Author

Choose a reason for hiding this comment

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

If we set it toundefined then it gets merged with the default settings and gets set to what you have defined in settings. But if it is set, this has a higher priority

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I was thinking it would overwrite it but you're right. Alright let's give this a shot

},
})
.then(res => res.json<Record<string, unknown>>())
Expand Down Expand Up @@ -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,
})
Expand Down
Loading