mchades commented on code in PR #9821:
URL: https://github.com/apache/gravitino/pull/9821#discussion_r2754217215


##########
catalogs/catalog-jdbc-common/src/main/java/org/apache/gravitino/catalog/jdbc/operation/JdbcTableOperations.java:
##########
@@ -95,6 +100,90 @@ public void initialize(
     this.columnDefaultValueConverter = jdbcColumnDefaultValueConverter;
   }
 
+  /**
+   * Handles quoting for default values based on the column data type. For 
example, if the default
+   * valur is ""(empty string), it will be represented as two single quotes '' 
for string-like
+   * columns, or NULL for others.
+   *
+   * @param column the column
+   * @param defaultValueExpression the default value expression
+   * @return the properly quoted default value as a string
+   */
+  protected String handleQuotingForDefaultValue(
+      JdbcColumn column, Expression defaultValueExpression) {
+    String defaultValue = 
columnDefaultValueConverter.fromGravitino(defaultValueExpression);
+
+    // Special handling for SQL NULL: do not quote it, even for string-like 
columns.
+    String trimmedDefault = defaultValue == null ? null : defaultValue.trim();

Review Comment:
   Why do we need to use `trim()`? I think using trim will change user input, 
for example, if the user wants to specify default values for two spaces (`  `), 
the spaces will disappear after `trim()`



-- 
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]

Reply via email to