Files
doris/docs/en/sql-reference/sql-functions/string-functions/unhex.md
zhoubintao ad949c2f65 Optimize Hex and add related Doc (#6697)
I tested hex in a 1000w times for loop with random numbers,
old hex avg time cost is 4.92 s,optimize hex avg time cost is 0.46 s which faster nearly 10x.
2021-10-13 11:36:14 +08:00

1.5 KiB

title, language
title language
unhex en

unhex

description

Syntax

VARCHAR unhex(VARCHAR str)

Enter a string, if the length of the string is 0 or an odd number, an empty string is returned; If the string contains characters other than [0-9], [a-z], [A-Z], an empty string is returned; In other cases, every two characters are a group of characters converted into hexadecimal, and then spliced into a string for output.

example

mysql> select unhex('@');
+------------+
| unhex('@') |
+------------+
|            |
+------------+

mysql> select unhex('41');
+-------------+
| unhex('41') |
+-------------+
| A           |
+-------------+

mysql> select unhex('4142');
+---------------+
| unhex('4142') |
+---------------+
| AB            |
+---------------+

keyword

UNHEX