Skip to content
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

uuid() called only once when used in projection list #7011

Closed
monetdb-team opened this issue Nov 30, 2020 · 0 comments
Closed

uuid() called only once when used in projection list #7011

monetdb-team opened this issue Nov 30, 2020 · 0 comments
Labels
bug Something isn't working normal SQL

Comments

@monetdb-team
Copy link

Date: 2020-11-15 20:42:24 +0100
From: @swingbit
To: SQL devs <>
Version: 11.39.5 (Oct2020)
CC: @PedroTadim

Last updated: 2020-11-24 11:37:23 +0100

Comment 28270

Date: 2020-11-15 20:42:24 +0100
From: @swingbit

User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36
Build Identifier:

While rand() is called for every tuple, uuid() is called only once and then projected.

sql>select sys.rand() from sys.generate_series(1,5);
+------------+
| %4 |
+============+
| 1369990470 |
| 1138053833 |
| 761390791 |
| 532576399 |
+------------+
4 tuples

sql>select sys.uuid() from sys.generate_series(1,5);
+--------------------------------------+
| %4 |
+======================================+
| f4c13fde-f49c-40d3-862b-c9006b21c6d1 |
| f4c13fde-f49c-40d3-862b-c9006b21c6d1 |
| f4c13fde-f49c-40d3-862b-c9006b21c6d1 |
| f4c13fde-f49c-40d3-862b-c9006b21c6d1 |
+--------------------------------------+
4 tuples

Reproducible: Always

Comment 28273

Date: 2020-11-16 09:08:53 +0100
From: @PedroTadim

I stumbled upon this about two months ago, and I think the bug is on the rand function rather the uuid one. As the function doesn't have arguments, it has atomic cardinality and from my point of view it makes sense to be only computed once. At the same time, we don't have any hint in the compiler to determine if a function without arguments will be deterministic for every row, eg. pi() is deterministic so it should be computed only once.

I think the solution would be to provide a version with a single argument where we can extract the input's number of rows, then compute it differently for every row.

Comment 28274

Date: 2020-11-16 18:34:16 +0100
From: MonetDB Mercurial Repository <>

Changeset 60d3da464f74 made by Pedro Ferreira pedro.ferreira@monetdbsolutions.com in the MonetDB repo, refers to this bug.

For complete details, see https//devmonetdborg/hg/MonetDB?cmd=changeset;node=60d3da464f74

Changeset description:

Fixed bug #7011. Add a version of sys.uuid function with a dummy parameter, so it gets a bulk implementation
@monetdb-team monetdb-team added bug Something isn't working normal SQL labels Nov 30, 2020
@sjoerdmullender sjoerdmullender added this to the Ancient Release milestone Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working normal SQL
Projects
None yet
Development

No branches or pull requests

2 participants