hyperdx/packages/common-utils/package.json
Drew Davis 8190ee8f6a
perf: Improve getKeyValues query performance for JSON keys (#1284)
Closes HDX-2623

# Summary

This change improves the performance of `getKeyValues` when getting values of a JSON key. 

Generally, columns that are not referenced outside of a CTE will be pruned by the query planner. For JSON however, if the outer select references one field in a JSON column, then the inner select will read (it seems) the entire JSON object.

This PR also adds integration tests for `getKeyValues` to ensure that the function generates queries that work as expected in ClickHouse.

##  Performance impact (on single JSON Dashboard Filter)

- Original: 15.03s

<img width="584" height="71" alt="Screenshot 2025-10-21 at 3 28 07 PM" src="https://github.com/user-attachments/assets/184de198-cee1-4b1d-beed-ec4465d3e248" />

- Optimized: 0.443s

<img width="590" height="61" alt="Screenshot 2025-10-21 at 3 25 47 PM" src="https://github.com/user-attachments/assets/690d0ef0-15b8-47c5-9a7e-8b8f6b8f5e92" />
2025-10-27 16:46:46 +00:00

64 lines
2 KiB
JSON

{
"name": "@hyperdx/common-utils",
"description": "Common utilities for HyperDX application",
"version": "0.7.1",
"license": "MIT",
"private": true,
"files": [
"dist/*"
],
"engines": {
"node": ">=22.16.0"
},
"dependencies": {
"@clickhouse/client": "^1.12.1",
"@clickhouse/client-common": "^1.12.1",
"@clickhouse/client-web": "^1.12.1",
"@hyperdx/lucene": "^3.1.1",
"date-fns": "^2.28.0",
"date-fns-tz": "^2.0.0",
"lodash": "^4.17.21",
"node-sql-parser": "^5.3.5",
"object-hash": "^3.0.0",
"semver": "^7.5.2",
"sql-formatter": "^15.4.11",
"sqlstring": "^2.3.3",
"store2": "^2.14.4",
"uuid": "^8.3.2",
"zod": "3.25"
},
"devDependencies": {
"@types/hyperdx__lucene": "npm:@types/lucene@*",
"@types/jest": "^28.1.1",
"@types/lodash": "^4.14.198",
"@types/object-hash": "^2.2.1",
"@types/semver": "^7.3.12",
"@types/sqlstring": "^2.3.0",
"@types/supertest": "^2.0.12",
"@types/uuid": "^8.3.4",
"dotenv": "^17.2.3",
"jest": "^28.1.1",
"nodemon": "^2.0.20",
"rimraf": "^4.4.1",
"supertest": "^6.3.1",
"ts-jest": "^28.0.5",
"ts-node": "^10.8.1",
"tsc-alias": "^1.8.8",
"tsconfig-paths": "^4.2.0",
"tsup": "^8.4.0",
"typescript": "^4.9.5"
},
"scripts": {
"dev": "nodemon --watch ./src --ext ts --exec \"yarn dev:build\"",
"dev:build": "tsup && tsc --emitDeclarationOnly --declaration",
"build": "tsup",
"ci:build": "tsup",
"lint": "npx eslint --quiet . --ext .ts",
"lint:fix": "npx eslint . --ext .ts --fix",
"ci:lint": "yarn lint && yarn tsc --noEmit",
"ci:unit": "jest --runInBand --ci --forceExit --coverage",
"dev:unit": "jest --watchAll --runInBand --detectOpenHandles",
"ci:int": "DOTENV_CONFIG_PATH=.env.test jest --config jest.int.config.js --runInBand --ci --forceExit --coverage",
"dev:int": "DOTENV_CONFIG_PATH=.env.test jest --config jest.int.config.js --watchAll --runInBand --detectOpenHandles"
}
}