github-actions[bot] commented on code in PR #63528:
URL: https://github.com/apache/doris/pull/63528#discussion_r3314346603


##########
be/src/core/data_type_serde/complex_type_deserialize_util.h:
##########
@@ -78,13 +79,32 @@ struct ComplexTypeDeserializeUtil {
 
     static bool is_null_string(const StringRef& str) {
         if (str.size == 4) {
-            // null
-            return str.data[0] == 'n' && str.data[1] == 'u' && str.data[2] == 
'l' &&
-                   str.data[3] == 'l';
+            // SQL NULL literal is case-insensitive.
+            return (str.data[0] == 'n' || str.data[0] == 'N') &&
+                   (str.data[1] == 'u' || str.data[1] == 'U') &&
+                   (str.data[2] == 'l' || str.data[2] == 'L') &&
+                   (str.data[3] == 'l' || str.data[3] == 'L');
         }
         return false;
     }
 
+    static Status process_field(const DataTypeSerDeSPtr& serde, StringRef str, 
Field& field) {
+        str = str.trim_whitespace();
+        if (is_null_string(str)) {

Review Comment:
   This accepts an explicit nested `NULL` before checking whether the nested 
serde is actually nullable. That is fine for the existing nullable 
ARRAY/MAP/STRUCT element cases, but struct fields can be declared non-nullable 
(`STRUCT<f1:INT NOT NULL>` is represented by catalog 
`StructField.containsNull=false`). With a default like `STRUCT<f1:INT NOT NULL> 
DEFAULT '{NULL}'`, FE only validates the literal shape, `process_field()` 
returns a null `Field` for the non-nullable `DataTypeIntSerDe`, and the later 
`ColumnStruct::insert()` path tries to insert that null field into the non-null 
vector column instead of rejecting the default during parsing. Please only 
accept `NULL` here when the provided serde is `DataTypeNullableSerDe` 
(otherwise return an invalid default error), and add a regression/unit case for 
a non-nullable struct field default containing `NULL`.



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

Reply via email to