You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "my-vegetable-has-exploded (via GitHub)" <gi...@apache.org> on 2023/12/18 07:14:03 UTC

[I] Support cast between StructArray. [arrow-rs]

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: github-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support cast between StructArray. [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold commented on issue #5219:
URL: https://github.com/apache/arrow-rs/issues/5219#issuecomment-1878523832

   `label_issue.py` automatically added labels {'arrow'} from #5221


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Support cast between StructArray. [arrow-rs]

Posted by "tustvold (via GitHub)" <gi...@apache.org>.
tustvold closed issue #5219: Support cast between StructArray.
URL: https://github.com/apache/arrow-rs/issues/5219


-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org