gianm commented on PR #14653:
URL: https://github.com/apache/druid/pull/14653#issuecomment-1649481881

   Some tests are failing because `mv_to_array(s)` when `s` is string `null` 
returns `null` array. Previously, this would get stored in frames as `[null]`, 
but now it gets stored as `null`.
   
   I am not sure if this is a good change? It seems to me that when you call 
`mv_to_array(s)`, you're saying that you want to treat `s` as a multi-value 
string, even if it wasn't stored that way. And multi-value string columns 
cannot be `null` themselves. They can only be `[]` or `[null]`. So, IMO 
`[null]` is in fact the most reasonable thing to return.
   
   We could restore this behavior by updating `mv_to_array` to act accordingly. 
For example something like this:
   
   ```
       @Override
       public ExprEval apply(List<Expr> args, Expr.ObjectBinding bindings)
       {
         final ExprEval eval = args.get(0).eval(bindings);
   
         if (eval.type().isArray()) {
           // mv_to_array always returns string array, regardless of input 
array types.
           return eval.castTo(ExpressionType.STRING_ARRAY);
         } else {
           // Return single-element array. Avoid castTo, since that returns 
null array if the element is null.
           return ExprEval.ofArray(ExpressionType.asArrayType(eval.type()), new 
Object[]{eval.value()});
         }
       }
   ```
   
   Thoughts?


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