Copilot commented on code in PR #14917:
URL: https://github.com/apache/gravitino/pull/14917#discussion_r4623909508
##########
web-v2/web/src/lib/utils/index.js:
##########
@@ -190,6 +256,18 @@ export const genUpdates = (originalData, newData,
disableUpdate = false) => {
nullable: newColumnsMap[key].nullable
})
}
+ const newAutoIncrement = newColumnsMap[key].autoIncrement
+ if (
+ newAutoIncrement !== undefined &&
+ newAutoIncrement !== null &&
+ Boolean(originalColumnsMap[key].autoIncrement) !==
Boolean(newAutoIncrement)
+ ) {
+ updates.push({
+ '@type': 'updateColumnAutoIncrement',
+ fieldName: [newColumnsMap[key].name],
+ autoIncrement: Boolean(newColumnsMap[key].autoIncrement)
+ })
Review Comment:
On MySQL and OceanBase, changing AutoIncrement and a column comment in one
save can silently undo the AutoIncrement change: the later comment operation
rebuilds the full column definition with the original flag. This AutoIncrement
operation likewise restores the original type/nullability after earlier edits
to those attributes. Merge pending column edits in the connectors, or require
separate saves for these combinations; reordering alone will not preserve all
changes.
##########
web-v2/web/src/app/catalogs/rightContent/CreateTableDialog.js:
##########
@@ -597,6 +609,16 @@ export default function CreateTableDialog({ ...props }) {
form
.validateFields()
.then(async () => {
+ if (provider === 'jdbc-mysql' &&
hasMySQLAutoIncrementRenameConflict(cacheData?.columns, values?.columns)) {
+ Modal.warning({
+ title: 'Save these changes separately',
+ content:
+ 'For MySQL, rename an AutoIncrement column first. Then reopen
the table and disable AutoIncrement in a separate save.'
Review Comment:
OceanBase has the same rename/AutoIncrement conflict as MySQL, but this
guard excludes it, so renaming while disabling AutoIncrement fails when the
connector looks up the new name in the original table snapshot. The warning's
rename-first workaround also fails validation because the index fields retain
the original column name. Apply the guard to both providers and tell users to
disable AutoIncrement first, save, then reopen to rename.
##########
web-v2/web/src/app/catalogs/rightContent/entitiesContent/TableDetailsPage.js:
##########
@@ -46,6 +46,40 @@ const SetOwnerDialog = dynamic(() =>
import('@/components/SetOwnerDialog'), {
const { Title, Paragraph } = Typography
const { Search } = Input
+const formatColumnDefaultValue = defaultValue => {
+ const formatExpression = expression => {
+ if (!expression || typeof expression !== 'object') return ''
+
+ switch (expression.type) {
+ case 'literal':
+ return expression.value == null ? '' : String(expression.value)
Review Comment:
An empty-string literal default is formatted as `''` internally and then
replaced with `-` by the fallback at line 80. Consequently, a real SQL `DEFAULT
''` is displayed exactly like a column with no default, hiding valid metadata.
Please render empty-string literals explicitly (and distinguish explicit NULL
literals) before applying the missing-expression fallback.
--
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]