my-vegetable-has-exploded opened a new issue, #5219:
URL: https://github.com/apache/arrow-rs/issues/5219

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to  the *what*)
   -->
   
   In https://github.com/apache/arrow-datafusion/issues/6635, we think 
supporting cast between StructArray will be helpful to implement multi column 
In list.
   
   For example, 
   
   ```
   ❯ CREATE TABLE colors (
       color_id INT PRIMARY KEY,
       color_name VARCHAR(50)
   );
   0 rows in set. Query took 0.002 seconds.
   
   ❯ INSERT INTO colors (color_id, color_name) VALUES (1, 'Red'), (2, 'Blue');
   +-------+
   | count |
   +-------+
   | 2     |
   +-------+
   1 row in set. Query took 0.002 seconds.
   
   ❯ SELECT * FROM colors WHERE struct(color_id) IN (struct(1));
   type_coercion
   caused by
   Error during planning: Can not find compatible types to compare 
Struct([Field { name: "c0", data_type: Int32, nullable: true, dict_id: 0, 
dict_is_ordered: false, metadata: {} }]) with [Struct([Field { name: "c0", 
data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: 
{} }])]
   ```
   
   After supporting cast between StructArray, we can just use 
```struct(color_id) IN (struct(1))``` rather than ```struct(color_id) IN 
(struct(arrow_cast(1,'Int32')));``` in this example.
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   
   - check can_cast_types recursively for each field
   - cast_with_options recursively for each field
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features 
you've considered.
   -->
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   
   I'm willing to submit a pr later.


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

Reply via email to