Repository navigation
feat(app): add an option to show MATERIALIZED and ALIAS columns in the row details panel #3231
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
9bf2e8c
fcd4774
fa630d7
274cd95
43dcfc2
80207e7
e269745
ddba013
04232a7
3f14876
77c7851
e59653e
b858fc0
958b87b
98917cb
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 |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| --- | ||
| '@hyperdx/app': patch | ||
| --- | ||
|
|
||
| feat: add an option to show MATERIALIZED and ALIAS columns in the row details panel | ||
|
|
||
| ClickHouse leaves MATERIALIZED and ALIAS columns out of `SELECT *`, so the row | ||
| details panel never showed them. A new "Show materialized and alias columns" | ||
| item in the properties view options menu, off by default, adds | ||
| `asterisk_include_materialized_columns` and `asterisk_include_alias_columns` to | ||
| the row query. It has no effect on a source with a Known Columns List, and a | ||
| value that the source's query settings give for either setting wins. If the row | ||
| fails to load while the option is on (for example, because the connection's user | ||
| is `readonly = 1`, or an ALIAS column cannot be evaluated), the error state | ||
| offers to turn the option off. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,10 @@ import { useDisclosure } from '@mantine/hooks'; | |
| import { IconAlertTriangle } from '@tabler/icons-react'; | ||
|
|
||
| import { IS_LOCAL_MODE } from '@/config'; | ||
| import { | ||
| useMaterializedAliasColumnsOption, | ||
| useSelectAllColumnsQuerySettings, | ||
| } from '@/hooks/useMaterializedAliasColumnsOption'; | ||
| import { useTableMetadata } from '@/hooks/useMetadata'; | ||
| import { useBrandDisplayName } from '@/theme/ThemeProvider'; | ||
|
|
||
|
|
@@ -82,6 +86,30 @@ function KnownColumnsListHint({ | |
| ); | ||
| } | ||
|
|
||
| // The option lives in the Column Values menu, which a failed row does not show. | ||
| function MaterializedAliasColumnsHint({ onHide }: { onHide: () => void }) { | ||
| return ( | ||
| <Alert | ||
| variant="warning" | ||
| icon={<IconAlertTriangle size={16} />} | ||
| title="Materialized and alias columns are on" | ||
| data-testid="materialized-alias-columns-hint" | ||
| > | ||
| <Stack gap="xs" align="start"> | ||
| <Text size="sm"> | ||
| The row query includes MATERIALIZED and ALIAS columns. The whole row | ||
| fails to load if the connection's user cannot change query | ||
| settings (for example, a readonly user) or if one of these columns | ||
| cannot be evaluated. | ||
| </Text> | ||
| <Button size="xs" variant="subtle" onClick={onHide}> | ||
| Hide materialized and alias columns | ||
| </Button> | ||
| </Stack> | ||
| </Alert> | ||
| ); | ||
| } | ||
|
|
||
| export function DBRowSidePanelErrorState({ | ||
| error, | ||
| source, | ||
|
|
@@ -94,6 +122,9 @@ export function DBRowSidePanelErrorState({ | |
|
|
||
| const showHint = | ||
| isMissingColumnError(error) && !!tableMetadata?.isPointerTable; | ||
| const selectAllColumnsSettings = useSelectAllColumnsQuerySettings(source); | ||
| const [, setShowMaterializedAliasColumns] = | ||
| useMaterializedAliasColumnsOption(); | ||
|
|
||
| return ( | ||
| <Stack gap="sm" data-testid="row-error-state"> | ||
|
|
@@ -103,6 +134,12 @@ export function DBRowSidePanelErrorState({ | |
| <KnownColumnsListHint onEditClick={editModal.open} source={source} /> | ||
| )} | ||
|
|
||
| {selectAllColumnsSettings != null && ( | ||
|
greptile-apps[bot] marked this conversation as resolved.
Resolved
Contributor
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. 🔵 minor — The materialized/alias warning appears for every row error, even ones the settings did not cause The hint only checks Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
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 intentional. The error screen hides the menu, so the button has to be there whenever the option could be the cause, and sorting settings errors from other errors is the check review asked me to drop. |
||
| <MaterializedAliasColumnsHint | ||
| onHide={() => setShowMaterializedAliasColumns(false)} | ||
| /> | ||
| )} | ||
|
|
||
| <Stack align="start"> | ||
| <Text size="sm" mt={10}> | ||
| Error Message: | ||
|
|
||
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.
🔵 minor — The option also changes row lookups that have no error state, so a failing ALIAS column blanks the span detail with no way to recover
useRowDataapplies the settings for every caller, includingSpanDetailPanelincomponents/DBTracePanel.tsx:120andcomponents/DBRowOverviewPanel.tsx:49. Both read onlydataand ignoreisError. With the option on, an ALIAS column that throws leaves the span detail empty and silent: no error state, and so no "Hide" action. Either renderDBRowSidePanelErrorStateon error inSpanDetailPanel, or pass the settings only from callers that can show the error (for example, anincludeMaterializedAliasColumnsargument onuseRowData).Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
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.
SpanDetailPanelandDBRowOverviewPanelalready ignoreisErrorfor every failure onmain, so making them show the error state would change files this PR doesn't touch. The option can still be turned off: from the Column Values menu when the side panel's own row loads, or from the new action in its error state when that row fails too.