Copilot commented on code in PR #64662:
URL: https://github.com/apache/doris/pull/64662#discussion_r3449674855


##########
be/src/exec/common/variant_util.cpp:
##########
@@ -244,6 +245,37 @@ Status cast_column(const ColumnWithTypeAndName& arg, const 
DataTypePtr& type, Co
     return Status::OK();
 }
 
+ColumnPtr jsonb_root_to_json_string_column(const IColumn& root) {
+    auto root_column = root.convert_to_full_column_if_const();
+    const IColumn* jsonb_column = root_column.get();
+    const NullMap* null_map = nullptr;
+    if (root_column->is_nullable()) {
+        const auto& nullable = assert_cast<const 
ColumnNullable&>(*root_column);
+        jsonb_column = &nullable.get_nested_column();
+        null_map = &nullable.get_null_map_data();
+    }
+
+    const auto& column = assert_cast<const ColumnString&>(*jsonb_column);

Review Comment:
   jsonb_root_to_json_string_column() unwraps ColumnNullable by taking 
nullable.get_nested_column(), but does not expand a nested ColumnConst. If the 
JSONB root is nullable+constant (ColumnNullable(ColumnConst(ColumnString))), 
the assert_cast<ColumnString> will fail at runtime. Convert the nested column 
with convert_to_full_column_if_const() before casting.



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