Problems comparing empty tuples/arrays
See original GitHub issue- EdgeDB Version:
1-beta1
I’ve been experimenting with DISTINCT
and discovered a few things:
- When different types are passed to distinct, it leaks implementation details (UNION) in error:
edgedb> select distinct {1, "1"};
ERROR: QueryError: operator 'UNION' cannot be applied to operands of type 'std::int64' and 'std::str'
Hint: Consider using an explicit type cast or a conversion function.
- It has some problems comparing empty tuples:
edgedb> select distinct {(), (), ()};
{(), (), ()}
Note: this doesn’t work with empty arrays, compiler makes me annotate 2nd argument.
Trying to figure out what’s going on, I tried comparing empty tuples manually. This is what I’ve got:
edgedb> select <tuple<str>>{} = ("",);
{}
edgedb> select <array<str>>{} = ["",];
{}
Not sure if these are issues that should be fixed or I misunderstood something.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
How to compare numpy arrays of tuples? - Stack Overflow
However if you compare with a_comp = np. array((-1,-1), dtype="i,i") you get the exact behavior you are expecting!
Read more >Python Tuples - GeeksforGeeks
Initial empty Tuple: () Tuple with the use of String: ('Geeks', ... left-hand side should be equal to a number of values in...
Read more >Python Tuple vs List - Comparison Between Lists and Tuples
This article explains the similarities and key differences between tuple vs list in python and it's importance while solving questions ...
Read more >Python: Check if Tuple is Empty - STechies
How to Check Empty Tuple in Python? · Using the not operator · Using the len() function · Comparing with another empty tuple....
Read more >Nim Tutorial (Part I) - Nim Programming Language
For comparing the performance with unsafe languages like C, use the -d:danger ... Other useful iterators for collections (like arrays and sequences) are....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@elprans
Maybe we should improve this error message. The fact that
{x, y}
is compiled tox UNION y
isn’t an obvious thing, especially to beginners. The error message we raise right now is just hard to interpret.@vpetrovykh please see if you can improve the error message.