Skip to content

Conversation

@LYHuang
Copy link
Contributor

@LYHuang LYHuang commented Apr 16, 2025

  • add new split function for brackets and quotes selection
  • should only affect SELECT section in search component
  • add test
image

Ref: hdx-1587

@changeset-bot
Copy link

changeset-bot bot commented Apr 16, 2025

⚠️ No Changeset found

Latest commit: 6b73d50

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

primaryKeys.trim() !== '' ? splitAndTrimCSV(primaryKeys) : [];
const allKeys = [...partitionKeyArr, ...primaryKeyArr];
if (typeof select === 'string') {
const selectSplit = splitAndTrimCSV(select);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the root cause, make input:
JSONExtractString(Body, 'object', 'c'),JSONExtractString(Body, 'object', 'note')
become
["JSONExtractString(Body", "'object'", "'c')", "'note')"]
after dedupe set(selectColumns).

Copy link
Member

@wrn14897 wrn14897 Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good find! have we thought about using module like csv-parse? (https://www.npmjs.com/package/csv-parse)

Copy link
Contributor Author

@LYHuang LYHuang Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked the csv-parse, however it does not work well with parentheses and brackets.
Parsing option quote only works for same character such as: "content", and it must at the beginning of the string, ex: "good", err"or".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. in this case, I think we want to make sure the unit tests cover all use cases. Does it work with the select field like "foo,bar",field2,field3 as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will split it to:

[
  '"foo',
  'bar"',
  'field2',
  'field3'
]

It should works fine if we don't get the input like: "foo,bar","foo,differentBar",field2,field3 and also doing the dedupe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will work on quote stuff, will update PR later.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, I'd imagine the return value from the example above is ["foo,bar", "field2", "field3"] although it's a corner case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the split function to support single quote and double quote, feel free to check test case.

@LYHuang LYHuang marked this pull request as ready for review April 16, 2025 05:34
@LYHuang LYHuang requested a review from wrn14897 April 17, 2025 02:59
@vercel
Copy link

vercel bot commented Apr 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hyperdx-v2-oss-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2025 2:01am

@wrn14897
Copy link
Member

We should also replace splitAndTrimCSV with new function

wrn14897
wrn14897 previously approved these changes Apr 18, 2025
Copy link
Member

@wrn14897 wrn14897 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great fix. Thank you!

@kodiakhq kodiakhq bot removed the automerge label Apr 18, 2025
@kodiakhq
Copy link
Contributor

kodiakhq bot commented Apr 18, 2025

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

@kodiakhq kodiakhq bot removed the automerge label Apr 22, 2025
@kodiakhq
Copy link
Contributor

kodiakhq bot commented Apr 22, 2025

This PR currently has a merge conflict. Please resolve this and then re-add the automerge label.

splitAndTrimCSV,
splitAndTrimWithBracket,
} from '@hyperdx/common-utils/dist/utils';
import { splitAndTrimWithBracket } from '@hyperdx/common-utils/dist/utils';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Granularity and splitAndTrimCSV is not used at here anymore, remove it since it cause conflict.

@LYHuang LYHuang requested a review from wrn14897 April 22, 2025 02:03
@kodiakhq kodiakhq bot merged commit 4acb8bc into v2 Apr 22, 2025
6 checks passed
@kodiakhq kodiakhq bot deleted the mh/hdx-1587-bug-multiple-function-calls-in-the-select-breaks-the-app branch April 22, 2025 02:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants