Skip to content

Commit 2ce2db9

Browse files
docs(app): note mixed-language series fall back to an unscoped search
The search URL ANDs its filters and carries a single where language, so it cannot OR a SQL series condition with a Lucene one; the union fallback leaves the search unscoped in that case. Pin that, and that a clicked series in such a chart still resolves to its own condition, with tests. Co-authored-by: Mike Shi <mike@hyperdx.io>
1 parent 3ac15df commit 2ce2db9

2 files changed

Lines changed: 40 additions & 0 deletions

File tree

‎packages/app/src/components/DBTimeChart.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,9 @@ export function decodeSeriesGroupFilters({
166166
* ratio column, or a formula column — fall back to the union of every series'
167167
* condition, which is the scan scope the chart itself used
168168
* (`aggConditionScopeFilter` yields nothing once any series is unfiltered).
169+
* Series mixing SQL and Lucene conditions also yield nothing: the search URL
170+
* ANDs its filters and carries one `where` language, so it has no way to OR
171+
* them, and an unscoped search is the safe superset.
169172
*/
170173
export function resolveSeriesConditionFilter({
171174
config,

‎packages/app/src/components/__tests__/DBTimeChart.test.tsx‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,43 @@ describe('DBTimeChart', () => {
764764
).toBeUndefined();
765765
});
766766

767+
// The search URL can't OR a SQL condition with a Lucene one.
768+
it('returns nothing when the series conditions mix languages', () => {
769+
expect(
770+
resolveSeriesConditionFilter({
771+
config: configWith({
772+
select: [
773+
series("ServiceName:'foo'", 'foo'),
774+
{
775+
...series("ServiceName = 'bar'", 'bar'),
776+
aggConditionLanguage: 'sql',
777+
},
778+
],
779+
}),
780+
resultColumns: ['foo', 'bar', '__hdx_time_bucket'],
781+
}),
782+
).toBeUndefined();
783+
});
784+
785+
// A clicked series still resolves even when its siblings use another language.
786+
it('resolves the clicked series in a mixed-language chart', () => {
787+
expect(
788+
resolveSeriesConditionFilter({
789+
config: configWith({
790+
select: [
791+
series("ServiceName:'foo'", 'foo'),
792+
{
793+
...series("ServiceName = 'bar'", 'bar'),
794+
aggConditionLanguage: 'sql',
795+
},
796+
],
797+
}),
798+
resultColumns: ['foo', 'bar', '__hdx_time_bucket'],
799+
valueColumnName: 'bar',
800+
}),
801+
).toEqual({ type: 'sql', condition: "ServiceName = 'bar'" });
802+
});
803+
767804
// Both series feed the single merged column, so neither can be singled out.
768805
it('unions both series of a ratio config rather than attributing one', () => {
769806
expect(

0 commit comments

Comments
 (0)