LevisNgigi commented on code in PR #38554:
URL: https://github.com/apache/superset/pull/38554#discussion_r2930219965
##########
superset-frontend/packages/superset-ui-chart-controls/src/components/labelUtils.tsx:
##########
@@ -64,11 +65,29 @@ export const getColumnLabelText = (column: ColumnMeta):
string =>
column.verbose_name || column.column_name;
export const getColumnTypeTooltipNode = (column: ColumnMeta): ReactNode => {
- if (!column.type) {
+ const rawType = typeof column.type === 'string' ? column.type.trim() : '';
+
+ let typeLabel: ReactNode | null = null;
+
+ if (rawType && rawType.toLowerCase() !== 'column') {
+ typeLabel = rawType;
+ } else if (typeof column.type_generic === 'number') {
+ if (column.type_generic === GenericDataType.String) {
+ typeLabel = t('string');
+ } else if (column.type_generic === GenericDataType.Numeric) {
+ typeLabel = t('numeric');
+ } else if (column.type_generic === GenericDataType.Temporal) {
+ typeLabel = t('timestamp');
+ } else if (column.type_generic === GenericDataType.Boolean) {
+ typeLabel = t('boolean');
+ }
+ }
Review Comment:
Not necessarily both fields are optional and can independently be missing or
unhelpful. type is the raw DB type string, while type_generic is a derived
enum. The logic simply prefers a meaningful raw type and falls back to
type_generic when needed.So it is a fallback chain but we prefer the specific
raw type string.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]