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


##########
be/src/vec/columns/column_object.cpp:
##########
@@ -340,7 +344,46 @@ void get_field_info_impl(const Field& field, FieldInfo* 
info) {
     };
 }
 
+void get_base_field_info(const Field& field, FieldInfo* info) {
+    const auto& variant_field = field.get<const VariantField&>();
+    const auto& wrapped_field = variant_field.get_field();
+    if (variant_field.get_type_id() == TypeIndex::Array) {
+        if (wrapped_field.safe_get<Array>().empty()) {
+            info->scalar_type_id = TypeIndex::Nothing;
+            ++info->num_dimensions;
+            info->have_nulls = true;
+            info->need_convert = false;
+        } else {
+            ++info->num_dimensions;
+            get_base_field_info(wrapped_field.safe_get<Array>()[0], info);
+        }
+        return;
+    }
+
+    // handle scalar types
+    info->scalar_type_id = variant_field.get_type_id();
+    info->have_nulls = true;
+    info->need_convert = false;
+    info->scale = variant_field.get_scale();
+    info->precision = variant_field.get_precision();
+
+    // Currently the jsonb type should be the top level type, so we should not 
wrap it in array,
+    // see create_array_of_type.
+    // TODO we need to support array<jsonb> correctly
+    if (UNLIKELY(variant_field.get_type_id() == TypeIndex::JSONB && 
info->num_dimensions > 0)) {

Review Comment:
   wrapped_field



-- 
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: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to