fix: use_top_k_dynamic_filtering setting causing issues when ORDER BY is not a column (#1789)

This commit is contained in:
Aaron Knudtson 2026-02-24 08:50:42 -05:00 committed by GitHub
parent 9488421ac6
commit cd2b7a7615
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 4 deletions

View file

@ -0,0 +1,6 @@
---
"@hyperdx/common-utils": minor
"@hyperdx/app": minor
---
fix: revert use_top_k_dynamic_filtering setting for issues with ORDER BY rand()

View file

@ -456,7 +456,7 @@ describe('processClickhouseSettings - optimization settings', () => {
},
{ name: 'use_skip_indexes_for_top_k', value: '1' },
{ name: 'query_plan_max_limit_for_top_k_optimization', value: '100000' },
{ name: 'use_top_k_dynamic_filtering', value: '1' },
// { name: 'use_top_k_dynamic_filtering', value: '1' },
{ name: 'use_skip_indexes_on_data_read', value: '1' },
{ name: 'use_skip_indexes_for_disjunctions', value: '1' },
]);
@ -480,7 +480,7 @@ describe('processClickhouseSettings - optimization settings', () => {
query_plan_max_limit_for_lazy_materialization: '100000',
use_skip_indexes_for_top_k: '1',
query_plan_max_limit_for_top_k_optimization: '100000',
use_top_k_dynamic_filtering: '1',
// use_top_k_dynamic_filtering: '1',
use_skip_indexes_on_data_read: '1',
use_skip_indexes_for_disjunctions: '1',
});
@ -512,7 +512,7 @@ describe('processClickhouseSettings - optimization settings', () => {
use_skip_indexes_on_data_read: '1',
});
expect(settings.query_plan_optimize_lazy_materialization).toBeUndefined();
expect(settings.use_top_k_dynamic_filtering).toBeUndefined();
// expect(settings.use_top_k_dynamic_filtering).toBeUndefined();
});
it('should merge external clickhouse settings with optimization settings', async () => {

View file

@ -545,7 +545,8 @@ export abstract class BaseClickhouseClient {
'query_plan_max_limit_for_top_k_optimization',
'100000',
);
applySettingIfAvailable('use_top_k_dynamic_filtering', '1');
// TODO: HDX-3499 look into when we can and can't use this setting. For example, event deltas ORDER BY rand(), which is not compatible with this setting
// applySettingIfAvailable('use_top_k_dynamic_filtering', '1');
// Enables skip indexes to be used on data read
applySettingIfAvailable('use_skip_indexes_on_data_read', '1');
// Evaluate WHERE filters with mixed AND and OR conditions using skip indexes.