#### /tags/release-0.0.0-rc0/hive/external/ql/src/test/results/clientpositive/udf_unhex.q.out

#
text | 71 lines | 67 code | 4 blank | 0 comment | 0 complexity | a23832d9899011678a111a8bfd9a32af MD5 | raw file
``` 1PREHOOK: query: DESCRIBE FUNCTION unhex
2PREHOOK: type: DESCFUNCTION
3POSTHOOK: query: DESCRIBE FUNCTION unhex
4POSTHOOK: type: DESCFUNCTION
5unhex(str) - Converts hexadecimal argument to string
6PREHOOK: query: DESCRIBE FUNCTION EXTENDED unhex
7PREHOOK: type: DESCFUNCTION
8POSTHOOK: query: DESCRIBE FUNCTION EXTENDED unhex
9POSTHOOK: type: DESCFUNCTION
10unhex(str) - Converts hexadecimal argument to string
11Performs the inverse operation of HEX(str). That is, it interprets
12each pair of hexadecimal digits in the argument as a number and
13converts it to the character represented by the number. The
14resulting characters are returned as a binary string.
15
16Example:
17> SELECT UNHEX('4D7953514C') from src limit 1;
18'MySQL'
19> SELECT UNHEX(HEX('string')) from src limit 1;
20'string'
21> SELECT HEX(UNHEX('1267')) from src limit 1;
22'1267'
23
24The characters in the argument string must be legal hexadecimal
25digits: '0' .. '9', 'A' .. 'F', 'a' .. 'f'. If UNHEX() encounters
26any nonhexadecimal digits in the argument, it returns NULL. Also,
27if there are an odd number of characters a leading 0 is appended.
28PREHOOK: query: -- Good inputs
29
30SELECT
31  unhex('4D7953514C'),
32  unhex('31323637'),
33  unhex('61'),
34  unhex('2D34'),
35  unhex('')
36FROM src limit 1
37PREHOOK: type: QUERY
38PREHOOK: Input: default@src
39PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1211131149/10000
40POSTHOOK: query: -- Good inputs
41
42SELECT
43  unhex('4D7953514C'),
44  unhex('31323637'),
45  unhex('61'),
46  unhex('2D34'),
47  unhex('')
48FROM src limit 1
49POSTHOOK: type: QUERY
50POSTHOOK: Input: default@src
51POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1211131149/10000
52MySQL	1267	a	-4
54SELECT
55  unhex('MySQL'),
56  unhex('G123'),
57  unhex('\0')
58FROM src limit 1
59PREHOOK: type: QUERY
60PREHOOK: Input: default@src
61PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1374300168/10000