-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot create a List
of FixedSizedList
in SQL
#13819
Comments
If we eagerly convert a fixed-size list into a standard list, we can avoid handling fixed-size lists in array functions. While this approach isn't entirely straightforward, it aligns with the intended result: query T
select arrow_typeof(arrow_cast([1,2,3], 'FixedSizeList(3, Int64)'));
----
FixedSizeList(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }, 3)
// make_array() coerce fixed size list to list
query T
select arrow_typeof(make_array(arrow_cast([1,2,3], 'FixedSizeList(3, Int64)')));
----
List(Field { name: "item", data_type: List(Field { name: "item", data_type: Int64, nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }), nullable: true, dict_id: 0, dict_is_ordered: false, metadata: {} }) The "issue" that eagerly coerce to list is not clear to me. |
The downside is that we have additional casting that is not necessary. |
I see -- so in your mind this behavior is "working as intended" with the current design? (this is fine from my perspective, I just found it confusing and it lead to lots of discussions on #13756 , so perhaps we can add some more documentation) I don't have time to work on this particular issue, I was just trying to get it filed |
Now, I think as long as the fixed size list is not mutated, we can keep it as fixed size list, |
List
of FixedSizedList
in SQLList
of FixedSizedList
in SQL
That makes sense -- if you ever try to change the size of a fixed size list, it may no longer be fixed size! |
take |
BTW it is not clear to me that the desired behavior for this ticket is clear (so I don't want to waste your time @alan910127 ) I may be mistaken, but it might be a good idea to clarify what you are planning to do here (is it to make the example I proposed work?) |
@alamb Sorry for the late response. Based on your discussion, I think making your example work with the behavior aligning with DuckDB (i.e. don't cast back to |
sounds like a good planto me |
Describe the bug
I expect that when I make a List / Array the element types remain the same
For example, a list of
Int32
makes List(Int32)However, creating a List of
FixedSizedList
creates aList(List))
rather than aList(FixedSizedList)
To Reproduce
This creates a FixedSizeList
You can see that here:
I expect that by wrapping it with
[]
it becomes a List of FixedSizedList, but it does not:Expected behavior
I expect the output of this to be
Additional context
Follow on from discussion in
The text was updated successfully, but these errors were encountered: