eldenmoon commented on code in PR #54044:
URL: https://github.com/apache/doris/pull/54044#discussion_r2241445851


##########
be/src/vec/data_types/data_type_array.cpp:
##########
@@ -364,4 +364,40 @@ Status DataTypeArray::from_string(ReadBuffer& rb, IColumn* 
column) const {
     return Status::OK();
 }
 
+FieldWithDataType DataTypeArray::get_field_with_data_type(const IColumn& 
column,
+                                                          size_t row_num) 
const {
+    const auto& array_column = assert_cast<const ColumnArray&>(column);
+    int precision = -1;
+    int scale = -1;
+    auto nested_type = get_nested_type();
+    PrimitiveType nested_type_id = nested_type->get_primitive_type();
+    uint8_t num_dimensions = 1;
+    while (nested_type_id == TYPE_ARRAY) {
+        nested_type = remove_nullable(nested_type);
+        const auto& nested_array = assert_cast<const 
DataTypeArray&>(*nested_type);
+        nested_type_id = nested_array.get_nested_type()->get_primitive_type();
+        num_dimensions++;
+    }
+    if (is_decimal(nested_type_id)) {
+        precision = nested_type->get_precision();
+        scale = nested_type->get_scale();
+    } else if (nested_type_id == TYPE_DATETIMEV2) {
+        scale = nested_type->get_scale();
+    } else if (nested_type_id == TYPE_JSONB) {
+        // Array<Jsonb> should return JsonbField as element
+        Array arr;

Review Comment:
   right,我先加个DCHECK,目前没有地方会出现array<array<jsonb>>



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