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


##########
be/src/exprs/function/function_jsonb.cpp:
##########
@@ -1386,7 +1386,8 @@ struct JsonbLengthUtil {
         }
 
         for (size_t i = 0; i < input_rows_count; ++i) {
-            if (jsonb_data_column->is_null_at(i) || path_column->is_null_at(i) 
||
+            if (jsonb_data_column->is_null_at(i) ||

Review Comment:
   [P1] Reuse the physical row for a constant JSON input
   
   `unpack_if_const` above turns a `ColumnConst` JSON argument into its one-row 
data column, but this loop still reads that payload with logical row `i` (and 
does so again in both `get_data_at(i)` calls). The framework only collapses 
execution to one row when *all* arguments are constant, so a multi-row call 
such as `json_length(CAST('{"a":[1]}' AS JSON), path_column)` reaches row 1 
with `jsonb_data_const == true` and reads past the one-row `ColumnString`. 
Please derive `jsonb_index = index_check_const(i, jsonb_data_const)` and use it 
for every JSON null/data access in this loop, with a mixed 
constant-JSON/varying-path test.



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