[MDEV-27482] 2-argument CRC32 and CRC32C don't work in virtual column expressions Created: 2022-01-12 Updated: 2022-01-14 Resolved: 2022-01-14 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server, Virtual Columns |
| Affects Version/s: | N/A |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
This works (from the same table):
|
| Comments |
| Comment by Marko Mäkelä [ 2022-01-14 ] |
|
elenst, please note that the two arguments were swapped since the preview release. The first argument is supposed to be numeric. The result looks correct to me. crc32('1') returns the same result as the test case’s funny way of writing crc32(0,'1'). |
| Comment by Marko Mäkelä [ 2022-01-14 ] |
|
Sorry, I realized it indeed is an implementation problem. I checked with rr replay that in Create_func_crc32c::create_native() and Create_func_crc32::create_native() the arguments are being passed in the correct order to Item_func_crc32::Item_func_crc32(). I suspect that the problem may be in something related to virtual column expressions, because the problem only occurs when evaluating the virtual column. I will try to find the root cause. |
| Comment by Marko Mäkelä [ 2022-01-14 ] |
|
I tested with a couple of variadic functions (atan, lpad), and they worked correctly in this context. The cause turned out to be that Create_func_crc32c::create_native() and Create_func_crc32::create_native() are swapping the operands, so that Item_func_crc32::val_int() would always have the string argument in the first operand. Apparently something in the virtual column implementation assumes that the operands are not being swapped. |