You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request]: Implement UNHEX() to replace DECODE("xxx", "hex") #15261
Is there an existing issue for the same feature request?
I have checked the existing issues.
Is your feature request related to a problem?
We had previously implemented the HEX() function #4773. However, we did not implement the UNHEX() function. When we are refactoring #15027 to its MYSQL API, we need to replace the existing decode("xx", "hex") with UNHEX("xx") for Vector Binary Insert.
Hi @arjunsk, I have basically implemented UNHEX, but there is still one thing that is unclear to me: how do I return NULL? Just like in this example from the documentation:
mysql> SELECT UNHEX('www');
+--------------+
| UNHEX('www') |
+--------------+
| NULL |
+--------------+
1 row in set (0.00 sec)
I return nil in opUnaryBytesToBytes, but in the console, I only get an empty result:
mysql> SELECT UNHEX('www');
+------------+
| unhex(www) |
+------------+
| |
+------------+
1 row in set (0.00 sec)
Activity
xxxuuu commentedon Apr 8, 2024
Hi @arjunsk, have you already been working on this issue? I'd like to give it a try.
arjunsk commentedon Apr 8, 2024
Thank you @xxxuuu .
The logic is mostly implemented here
matrixone/pkg/sql/plan/function/func_binary.go
Lines 2246 to 2251 in 0960f0f
You just need to define a new
function_idfor theUNHEXand port this logic there.The return type is BLOB (because this function will be used for inserting VECTOR values as BLOB)
xxxuuu commentedon Apr 9, 2024
Hi @arjunsk, I have basically implemented
UNHEX, but there is still one thing that is unclear to me: how do I returnNULL? Just like in this example from the documentation:I return
nilinopUnaryBytesToBytes, but in the console, I only get an empty result:arjunsk commentedon Apr 9, 2024
Hi @xxxuuu , this is a quick example of how NULL is returned (without using opUnaryBytesToBytes)
matrixone/pkg/sql/plan/function/func_unary.go
Lines 1235 to 1236 in 0960f0f
arjunsk commentedon Apr 11, 2024
Thank you for your contribution @xxxuuu
arjunsk commentedon Apr 11, 2024
Pending changes
arjunsk commentedon Apr 11, 2024
Document for UNHEX
https://doc.weixin.qq.com/doc/w3_AawAhAZmAIku2NYoOi3S802xrQKST?scode=AJsA6gc3AA8eG0NzsiAawAhAZmAIk&is_external=0&commentVersion=1712873541000&doc_title=Untitled%20Doc&wxworkQt=1&qt_source=Conv&qt_report_identifier=1712873544158
Document for Changes related to Vector Binary IO
https://doc.weixin.qq.com/doc/w3_AawAhAZmAIkisFFt0fYQkCzW6iJq7?scode=AJsA6gc3AA80XYaLC0AawAhAZmAIk&is_external=0&commentVersion=1712876797000&doc_title=VECTOR%20BINARY%20IO%20changes&wxworkQt=1&qt_source=Conv&qt_report_identifier=1712876808603
CC: @yangj1211
arjunsk commentedon Apr 12, 2024
This issue is ready for testing.
Ariznawlll commentedon Jun 6, 2024
hex() and unhex() test done