tobixdev commented on issue #12622:
URL: https://github.com/apache/datafusion/issues/12622#issuecomment-2599650066

   > I think downstream project are not all forced to switch to `Scalar` they 
can keep their `ScalarValue` matching code, except for Utf8View and LargeUtf8 
matching cases
   > 
   > `Scalar` is introduced to separate the concept of arrow's DataType with 
the value itself.
   
   Sorry I wasn't clear on this. I meant that matching directly on 
`ColumnarValue` is not possible anymore. Basically, you have to create nested 
match statements and call `.value()` on the `Scalar`. 
   
   ```rust
   let take_idx = match &args[2] {
       ColumnarValue::Scalar(ScalarValue::Int64(Some(v))) if v < &2 => *v as 
usize,
       _ => unreachable!(),
   };
   ```
   
   becomes 
   
   ```rust
   let take_idx = match &args[2] {
       ColumnarValue::Scalar(scalar) => match scalar.value() {
           ScalarValue::Int64(Some(v)) if v < &2 => *v as usize,
           _ => unreachable!(),
       },
       _ => unreachable!(),
   }
   ```
   
   And this isn't a deal breaker for me as one may argue that distinguishing 
between scalar/non-scalar and scalar types are two pair of shoes and should be 
handled separately, but at least in some cases this will impact ergonomics 
(e.g., tests). Maybe this also isn't such a big deal if downstream projects are 
not using these types of patterns.
   
   > If we can find such approach it would be great. `Scalar` is just a 
practical approach that we can iterate on it with. There might be a better 
solution toward the goal, but I have no such idea in my mind.
   
   I also don't know a good solution and maybe `Scalar` is the best way to 
achieve this. But maybe we are also approaching this wrong and we might just 
require some tinkering at a different spot such that removing 
`ScalarValue::LargeUtf8` and `ScalarValue::Utf8View` just becomes removing the 
enum variants. Sorry if I am rehashing some conversations here that you already 
had earlier. Just want to make sure that we are on the right track. :)
   


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