This is an automated email from the ASF dual-hosted git repository.

LauraXia123 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new 2ea8fcf182 [#13951] improvement(web): Show full column types in table 
and view details (#13952)
2ea8fcf182 is described below

commit 2ea8fcf1828757856a3d92085f9d9ed2cb0e3763
Author: Ofer Helman <[email protected]>
AuthorDate: Wed Nov 11 05:44:50 2026 +0200

    [#13951] improvement(web): Show full column types in table and view details 
(#13952)
    
    ### What changes were proposed in this pull request?
    
    Show the full column type in the web UI instead of only its outer name.
    
    - Add `formatColumnType` (`src/lib/utils/columnType.js`, in `web/web`
    and `web-v2/web`). It formats the REST type JSON like
    `Type.simpleString()`: `list<string>`, `map<string,long>`, `struct<id:
    long NOT NULL,tags: list<string>>`, `union<...>`, `external(...)`,
    `unparsed(...)`. Struct fields omit `NULL` and the empty `COMMENT`.
    - `web/web` `ColumnTypeChip` and the `web-v2/web` table and view column
    tags use it, and set it as the hover title, since long types are
    truncated.
    - Type filters and colors are unchanged (still by the outer type name).
    
    ### Why are the changes needed?
    
    A `list<string>` column showed as `list`, a struct as `struct`, an
    external type as `external`: element, key, value and field types were
    not visible in the UI.
    
    Fix: #13951
    
    ### Does this PR introduce _any_ user-facing change?
    
    Yes. Complex column types in the table and view details show their full
    type, for example `list<string>` instead of `list`.
    
    ### How was this patch tested?
    
    - New unit tests `columnType.test.js` in both UIs (primitive, list,
    non-null list, nested map, struct, union, external, unparsed, missing).
    - `pnpm lint`, `pnpm prettier:check` and `pnpm test` in `web/web` and
    `web-v2/web`. In `web-v2/web`, `src/lib/store/auth/index.test.js` fails
    to load on `main` too, unrelated to this change.
    
    🤖 Generated with [Claude Code](https://claude.com/claude-code)
    
    ---------
    
    Co-authored-by: Claude Opus 5.5 <[email protected]>
    Co-authored-by: Cursor <[email protected]>
---
 .../entitiesContent/TableDetailsPage.js            | 11 +++-
 .../entitiesContent/ViewDetailsPage.js             | 11 +++-
 web-v2/web/src/lib/utils/columnType.js             | 45 ++++++++++++++++
 web-v2/web/src/lib/utils/columnType.test.js        | 61 ++++++++++++++++++++++
 web/web/src/components/ColumnTypeChip.js           | 14 +++--
 web/web/src/lib/utils/columnType.js                | 45 ++++++++++++++++
 web/web/src/lib/utils/columnType.test.js           | 61 ++++++++++++++++++++++
 7 files changed, 243 insertions(+), 5 deletions(-)

diff --git 
a/web-v2/web/src/app/catalogs/rightContent/entitiesContent/TableDetailsPage.js 
b/web-v2/web/src/app/catalogs/rightContent/entitiesContent/TableDetailsPage.js
index 90ad4a0d2e..9bf4a95855 100644
--- 
a/web-v2/web/src/app/catalogs/rightContent/entitiesContent/TableDetailsPage.js
+++ 
b/web-v2/web/src/app/catalogs/rightContent/entitiesContent/TableDetailsPage.js
@@ -36,6 +36,7 @@ import { getCatalogDetails, getCurrentEntityOwner } from 
'@/lib/store/metalakes'
 import CreateTableDialog from '../CreateTableDialog'
 import Loading from '@/components/Loading'
 import PropertiesContent from '@/components/PropertiesContent'
+import { formatColumnType } from '@/lib/utils/columnType'
 
 const SetOwnerDialog = dynamic(() => import('@/components/SetOwnerDialog'), {
   loading: () => <Loading />,
@@ -389,7 +390,15 @@ export default function TableDetailsPage({ ...props }) {
         filters: columnTypeFitlers,
         onFilter: (value, record) =>
           typeof record.type === 'string' ? record.type.indexOf(value) === 0 : 
record.type.type.indexOf(value) === 0,
-        render: type => <Tag color={columnTypeColor(type)}>{typeof type === 
'string' ? type : type.type}</Tag>
+        render: type => {
+          const formattedType = formatColumnType(type)
+
+          return (
+            <Tag color={columnTypeColor(type)} title={formattedType}>
+              {formattedType}
+            </Tag>
+          )
+        }
       },
       {
         title: 'Tags',
diff --git 
a/web-v2/web/src/app/catalogs/rightContent/entitiesContent/ViewDetailsPage.js 
b/web-v2/web/src/app/catalogs/rightContent/entitiesContent/ViewDetailsPage.js
index 8984156116..8c6bf67f34 100644
--- 
a/web-v2/web/src/app/catalogs/rightContent/entitiesContent/ViewDetailsPage.js
+++ 
b/web-v2/web/src/app/catalogs/rightContent/entitiesContent/ViewDetailsPage.js
@@ -47,6 +47,7 @@ import { useAppSelector } from '@/lib/hooks/useStore'
 import { useSearchParams } from 'next/navigation'
 import { formatToDateTime, isValidDate } from '@/lib/utils/date'
 import PropertiesContent from '@/components/PropertiesContent'
+import { formatColumnType } from '@/lib/utils/columnType'
 
 const { Title, Paragraph } = Typography
 const { Search } = Input
@@ -197,7 +198,15 @@ export default function ViewDetailsPage() {
         filters: columnTypeFilters,
         onFilter: (value, record) =>
           typeof record.type === 'string' ? record.type.indexOf(value) === 0 : 
record.type.type.indexOf(value) === 0,
-        render: type => <Tag color={columnTypeColor(type)}>{typeof type === 
'string' ? type : type.type}</Tag>
+        render: type => {
+          const formattedType = formatColumnType(type)
+
+          return (
+            <Tag color={columnTypeColor(type)} title={formattedType}>
+              {formattedType}
+            </Tag>
+          )
+        }
       },
       {
         title: 'Nullable',
diff --git a/web-v2/web/src/lib/utils/columnType.js 
b/web-v2/web/src/lib/utils/columnType.js
new file mode 100644
index 0000000000..e30a1bd6bf
--- /dev/null
+++ b/web-v2/web/src/lib/utils/columnType.js
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const withNotNull = (type, nullable) => (nullable === false ? `${type}, NOT 
NULL` : type)
+
+// The column type like the server's Type.simpleString(), such as 
list<string>; struct fields omit NULL and COMMENT.
+export const formatColumnType = type => {
+  if (type === null || type === undefined || typeof type === 'string') {
+    return type ?? ''
+  }
+  switch (type.type) {
+    case 'list':
+      return `list<${withNotNull(formatColumnType(type.elementType), 
type.containsNull)}>`
+    case 'map':
+      return 
`map<${formatColumnType(type.keyType)},${withNotNull(formatColumnType(type.valueType),
 type.valueContainsNull)}>`
+    case 'struct':
+      return `struct<${(type.fields || [])
+        .map(f => `${f.name}: ${formatColumnType(f.type)}${f.nullable === 
false ? ' NOT NULL' : ''}`)
+        .join(',')}>`
+    case 'union':
+      return `union<${(type.types || []).map(formatColumnType).join(',')}>`
+    case 'external':
+      return `external(${type.catalogString})`
+    case 'unparsed':
+      return `unparsed(${type.unparsedType})`
+    default:
+      return type.type ?? ''
+  }
+}
diff --git a/web-v2/web/src/lib/utils/columnType.test.js 
b/web-v2/web/src/lib/utils/columnType.test.js
new file mode 100644
index 0000000000..5e94483bae
--- /dev/null
+++ b/web-v2/web/src/lib/utils/columnType.test.js
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { describe, expect, it } from 'vitest'
+import { formatColumnType } from './columnType'
+
+describe('formatColumnType', () => {
+  it.each([
+    ['a primitive type', 'string', 'string'],
+    ['a list', { type: 'list', containsNull: true, elementType: 'string' }, 
'list<string>'],
+    [
+      'a list of non-null elements',
+      { type: 'list', containsNull: false, elementType: 'integer' },
+      'list<integer, NOT NULL>'
+    ],
+    [
+      'a map of lists',
+      {
+        type: 'map',
+        keyType: 'string',
+        valueContainsNull: true,
+        valueType: { type: 'list', containsNull: true, elementType: 'long' }
+      },
+      'map<string,list<long>>'
+    ],
+    [
+      'a struct',
+      {
+        type: 'struct',
+        fields: [
+          { name: 'id', type: 'long', nullable: false },
+          { name: 'tags', type: { type: 'list', containsNull: true, 
elementType: 'string' }, nullable: true }
+        ]
+      },
+      'struct<id: long NOT NULL,tags: list<string>>'
+    ],
+    ['a union', { type: 'union', types: ['integer', 'string'] }, 
'union<integer,string>'],
+    ['an external type', { type: 'external', catalogString: 'FixedSizeList(4)' 
}, 'external(FixedSizeList(4))'],
+    ['an unparsed type', { type: 'unparsed', unparsedType: 'geo' }, 
'unparsed(geo)'],
+    ['a missing type', undefined, ''],
+    ['an object without a type field', {}, '']
+  ])('formats %s', (_, type, expected) => {
+    expect(formatColumnType(type)).toBe(expected)
+  })
+})
diff --git a/web/web/src/components/ColumnTypeChip.js 
b/web/web/src/components/ColumnTypeChip.js
index f68293d120..51fdb876e7 100644
--- a/web/web/src/components/ColumnTypeChip.js
+++ b/web/web/src/components/ColumnTypeChip.js
@@ -22,13 +22,14 @@ import { ColumnTypeColorEnum } from 
'@/lib/enums/columnTypeEnum.js'
 import colors from '@/lib/theme/colors'
 import { alpha } from '@/lib/utils/color'
 import { isString } from 'lodash-es'
+import { formatColumnType } from '@/lib/utils/columnType'
 
 const ColumnTypeChip = props => {
   const { type = '' } = props
 
-  const formatType = type && isString(type) ? type.replace(/\(.*\)/, '') : type
+  const formatType = isString(type) ? type.replace(/\(.*\)/, '') : type?.type
 
-  const label = isString(type) ? type : `${type?.type}`
+  const label = formatColumnType(type)
 
   const columnTypeColor = ColumnTypeColorEnum[formatType] || 'secondary'
   const color = colors[columnTypeColor]?.main || '#8592A3'
@@ -37,7 +38,14 @@ const ColumnTypeChip = props => {
   return (
     <>
       {label ? (
-        <Chip size='small' label={label} sx={{ backgroundColor: bgColor }} 
color={columnTypeColor} variant='outlined' />
+        <Chip
+          size='small'
+          label={label}
+          title={label}
+          sx={{ backgroundColor: bgColor }}
+          color={columnTypeColor}
+          variant='outlined'
+        />
       ) : null}
     </>
   )
diff --git a/web/web/src/lib/utils/columnType.js 
b/web/web/src/lib/utils/columnType.js
new file mode 100644
index 0000000000..e30a1bd6bf
--- /dev/null
+++ b/web/web/src/lib/utils/columnType.js
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+const withNotNull = (type, nullable) => (nullable === false ? `${type}, NOT 
NULL` : type)
+
+// The column type like the server's Type.simpleString(), such as 
list<string>; struct fields omit NULL and COMMENT.
+export const formatColumnType = type => {
+  if (type === null || type === undefined || typeof type === 'string') {
+    return type ?? ''
+  }
+  switch (type.type) {
+    case 'list':
+      return `list<${withNotNull(formatColumnType(type.elementType), 
type.containsNull)}>`
+    case 'map':
+      return 
`map<${formatColumnType(type.keyType)},${withNotNull(formatColumnType(type.valueType),
 type.valueContainsNull)}>`
+    case 'struct':
+      return `struct<${(type.fields || [])
+        .map(f => `${f.name}: ${formatColumnType(f.type)}${f.nullable === 
false ? ' NOT NULL' : ''}`)
+        .join(',')}>`
+    case 'union':
+      return `union<${(type.types || []).map(formatColumnType).join(',')}>`
+    case 'external':
+      return `external(${type.catalogString})`
+    case 'unparsed':
+      return `unparsed(${type.unparsedType})`
+    default:
+      return type.type ?? ''
+  }
+}
diff --git a/web/web/src/lib/utils/columnType.test.js 
b/web/web/src/lib/utils/columnType.test.js
new file mode 100644
index 0000000000..5e94483bae
--- /dev/null
+++ b/web/web/src/lib/utils/columnType.test.js
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import { describe, expect, it } from 'vitest'
+import { formatColumnType } from './columnType'
+
+describe('formatColumnType', () => {
+  it.each([
+    ['a primitive type', 'string', 'string'],
+    ['a list', { type: 'list', containsNull: true, elementType: 'string' }, 
'list<string>'],
+    [
+      'a list of non-null elements',
+      { type: 'list', containsNull: false, elementType: 'integer' },
+      'list<integer, NOT NULL>'
+    ],
+    [
+      'a map of lists',
+      {
+        type: 'map',
+        keyType: 'string',
+        valueContainsNull: true,
+        valueType: { type: 'list', containsNull: true, elementType: 'long' }
+      },
+      'map<string,list<long>>'
+    ],
+    [
+      'a struct',
+      {
+        type: 'struct',
+        fields: [
+          { name: 'id', type: 'long', nullable: false },
+          { name: 'tags', type: { type: 'list', containsNull: true, 
elementType: 'string' }, nullable: true }
+        ]
+      },
+      'struct<id: long NOT NULL,tags: list<string>>'
+    ],
+    ['a union', { type: 'union', types: ['integer', 'string'] }, 
'union<integer,string>'],
+    ['an external type', { type: 'external', catalogString: 'FixedSizeList(4)' 
}, 'external(FixedSizeList(4))'],
+    ['an unparsed type', { type: 'unparsed', unparsedType: 'geo' }, 
'unparsed(geo)'],
+    ['a missing type', undefined, ''],
+    ['an object without a type field', {}, '']
+  ])('formats %s', (_, type, expected) => {
+    expect(formatColumnType(type)).toBe(expected)
+  })
+})

Reply via email to