mirror of
https://github.com/hyperdxio/hyperdx
synced 2026-04-21 13:37:15 +00:00
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:
parent
2bb8ccdc5a
commit
676e4f4bc9
2 changed files with 13 additions and 1 deletions
5
.changeset/eighty-foxes-look.md
Normal file
5
.changeset/eighty-foxes-look.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@hyperdx/app": patch
|
||||
---
|
||||
|
||||
fix: differentiate map indexing vs array indexing
|
||||
|
|
@ -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] => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue