-
Notifications
You must be signed in to change notification settings - Fork 343
fix incorrect split for select query #754
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
Changes from all commits
f43a422
9c01ebc
61fa993
2551e4d
11bd6b3
a4ab3c1
06a3f62
6b73d50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,7 +25,7 @@ import { | |
| ChartConfigWithDateRange, | ||
| SelectList, | ||
| } from '@hyperdx/common-utils/dist/types'; | ||
| import { Granularity, splitAndTrimCSV } from '@hyperdx/common-utils/dist/utils'; | ||
| import { splitAndTrimWithBracket } from '@hyperdx/common-utils/dist/utils'; | ||
| import { Box, Code, Flex, Text } from '@mantine/core'; | ||
| import { FetchNextPageOptions } from '@tanstack/react-query'; | ||
| import { | ||
|
|
@@ -810,10 +810,10 @@ function appendSelectWithPrimaryAndPartitionKey( | |
| .map(k => extractColumnReference(k.trim())) | ||
| .filter((k): k is string => k != null && k.length > 0); | ||
| const primaryKeyArr = | ||
| primaryKeys.trim() !== '' ? splitAndTrimCSV(primaryKeys) : []; | ||
| primaryKeys.trim() !== '' ? splitAndTrimWithBracket(primaryKeys) : []; | ||
| const allKeys = [...partitionKeyArr, ...primaryKeyArr]; | ||
| if (typeof select === 'string') { | ||
| const selectSplit = splitAndTrimCSV(select); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the root cause, make input:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I checked the
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It will split it to: It should works fine if we don't get the input like:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will work on quote stuff, will update PR later.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cool, I'd imagine the return value from the example above is
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
| const selectSplit = splitAndTrimWithBracket(select); | ||
| const selectColumns = new Set(selectSplit); | ||
| const additionalKeys = allKeys.filter(k => !selectColumns.has(k)); | ||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GranularityandsplitAndTrimCSVis not used at here anymore, remove it since it cause conflict.