fix: differentiate map key index vs array indexing (#2032)

## Summary

Previously array indexes were treated as map lookups, which caused them to be wrapped in quotations. This fixes array index query rendering by handling array indexes.

### References


- Related PRs: Closes https://github.com/hyperdxio/hyperdx/issues/1863
This commit is contained in:
Aaron Knudtson 2026-04-02 15:32:27 -04:00 committed by GitHub
parent 2bb8ccdc5a
commit 676e4f4bc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
"@hyperdx/app": patch
---
fix: differentiate map indexing vs array indexing

View file

@ -892,7 +892,14 @@ export const mergePath = (path: string[], jsonColumns: string[] = []) => {
.join('.'),
)
.join('.')}`
: `${key}['${rest.join("']['")}']`;
: `${key}${rest
.map(v => {
const asNumber = Number(v);
const isArrayIndex = Number.isInteger(asNumber) && asNumber >= 0;
// ClickHouse arrays are 1-based, but flattened data uses 0-based indices
return isArrayIndex ? `[${asNumber + 1}]` : `['${v}']`;
})
.join('')}`;
};
const _useTry = <T>(fn: () => T): [null | Error | unknown, null | T] => {