Skip to content

fix/escaped strings search #1064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

tombokombo
Copy link

I have problem with dynamic field in clickhouse json datatype. My database looks for now like this

 │ CREATE TABLE click.log_json_better                                                ↴│
   │↳(                                                                                 ↴│
   │↳    `log` JSON,                                                                   ↴│
   │↳    `ingest_time` DateTime64(9) DEFAULT now64(9)                                  ↴│
   │↳) 

If some field contains string like bellow
SELECT log.message, FROM click.log_json_better WHERE ...
with result

log.message──┐
1. │ {"took":7,"errors":false,"items":[{"create":{...trunc # sometimes valid json, sometimes not 

but this is representation, select for whole log

SELECT log
FROM click.log_json_better
WHERE (ingest_time = parseDateTime64BestEffort('2025-08-11T10:27:01.901588629Z', 9))...

truncated result with message part

trunc...4-536e18d9ad92"},"message":"{\"took\":7,\"errors\":false,\"items\...truc
image

so it's stored as escaped string and API is returning it as escaped string as well
"{\"took\":7,\"errors\":false...trunc
image

Then when I clicked on such row, it is escaped again and created query has no match in DB.

AND toString(`log`.message) = '{\\\"took\\\":4,...
image

so I've made a simple fix with SqlString.raw. I've tried to match record with md5, to not use whole field content for search query, but no luck with playing around with escaping and stripping escaping.

At first, I've removed Search value/object key too large. error, because this was problem that I've encountered as first, trowing error crashed whole UI. I've had no problem with string 10x larger than 1000 chars.

Copy link

changeset-bot bot commented Aug 11, 2025

🦋 Changeset detected

Latest commit: eef013d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Aug 11, 2025

@tombokombo is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant