PageRenderTime 29ms CodeModel.GetById 18ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

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

#
text | 190 lines | 186 code | 4 blank | 0 comment | 0 complexity | 00a8dc64288b911c4f02ff3efe61c662 MD5 | raw file
  1PREHOOK: query: DESCRIBE FUNCTION conv
  2PREHOOK: type: DESCFUNCTION
  3POSTHOOK: query: DESCRIBE FUNCTION conv
  4POSTHOOK: type: DESCFUNCTION
  5conv(num, from_base, to_base) - convert num from from_base to to_base
  6PREHOOK: query: DESCRIBE FUNCTION EXTENDED conv
  7PREHOOK: type: DESCFUNCTION
  8POSTHOOK: query: DESCRIBE FUNCTION EXTENDED conv
  9POSTHOOK: type: DESCFUNCTION
 10conv(num, from_base, to_base) - convert num from from_base to to_base
 11If to_base is negative, treat num as a signed integer,otherwise, treat it as an unsigned integer.
 12Example:
 13  > SELECT conv('100', 2, 10) FROM src LIMIT 1;
 14  '4'
 15  > SELECT conv(-10, 16, -10) FROM src LIMIT 1;
 16  '16'
 17PREHOOK: query: -- conv must work on both strings and integers up to 64-bit precision
 18
 19-- Some simple conversions to test different bases
 20SELECT
 21  conv('4521', 10, 36),
 22  conv('22', 10, 10),
 23  conv('110011', 2, 16),
 24  conv('facebook', 36, 16)
 25FROM src LIMIT 1
 26PREHOOK: type: QUERY
 27PREHOOK: Input: default@src
 28PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/502953018/10000
 29POSTHOOK: query: -- conv must work on both strings and integers up to 64-bit precision
 30
 31-- Some simple conversions to test different bases
 32SELECT
 33  conv('4521', 10, 36),
 34  conv('22', 10, 10),
 35  conv('110011', 2, 16),
 36  conv('facebook', 36, 16)
 37FROM src LIMIT 1
 38POSTHOOK: type: QUERY
 39POSTHOOK: Input: default@src
 40POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/502953018/10000
 413HL	22	33	116ED2B2FB4
 42PREHOOK: query: -- Test negative numbers. If to_base is positive, the number should be handled
 43-- as a two's complement (64-bit)
 44SELECT
 45  conv('-641', 10, -10),
 46  conv('1011', 2, -16),
 47  conv('-1', 10, 16),
 48  conv('-15', 10, 16)
 49FROM src LIMIT 1
 50PREHOOK: type: QUERY
 51PREHOOK: Input: default@src
 52PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1045444731/10000
 53POSTHOOK: query: -- Test negative numbers. If to_base is positive, the number should be handled
 54-- as a two's complement (64-bit)
 55SELECT
 56  conv('-641', 10, -10),
 57  conv('1011', 2, -16),
 58  conv('-1', 10, 16),
 59  conv('-15', 10, 16)
 60FROM src LIMIT 1
 61POSTHOOK: type: QUERY
 62POSTHOOK: Input: default@src
 63POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1045444731/10000
 64-641	B	FFFFFFFFFFFFFFFF	FFFFFFFFFFFFFFF1
 65PREHOOK: query: -- Test overflow. If a number is two large, the result should be -1 (if signed)
 66-- or MAX_LONG (if unsigned)
 67SELECT
 68  conv('9223372036854775807', 36, 16),
 69  conv('9223372036854775807', 36, -16),
 70  conv('-9223372036854775807', 36, 16),
 71  conv('-9223372036854775807', 36, -16)
 72FROM src LIMIT 1
 73PREHOOK: type: QUERY
 74PREHOOK: Input: default@src
 75PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/901682273/10000
 76POSTHOOK: query: -- Test overflow. If a number is two large, the result should be -1 (if signed)
 77-- or MAX_LONG (if unsigned)
 78SELECT
 79  conv('9223372036854775807', 36, 16),
 80  conv('9223372036854775807', 36, -16),
 81  conv('-9223372036854775807', 36, 16),
 82  conv('-9223372036854775807', 36, -16)
 83FROM src LIMIT 1
 84POSTHOOK: type: QUERY
 85POSTHOOK: Input: default@src
 86POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/901682273/10000
 87FFFFFFFFFFFFFFFF	-1	FFFFFFFFFFFFFFFF	-1
 88PREHOOK: query: -- Test with invalid input. If one of the bases is invalid, the result should
 89-- be NULL. If there is an invalid digit in the number, the longest valid
 90-- prefix should be converted.
 91SELECT
 92  conv('123455', 3, 10),
 93  conv('131', 1, 5),
 94  conv('515', 5, 100),
 95  conv('10', -2, 2)
 96FROM src LIMIT 1
 97PREHOOK: type: QUERY
 98PREHOOK: Input: default@src
 99PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1068643579/10000
100POSTHOOK: query: -- Test with invalid input. If one of the bases is invalid, the result should
101-- be NULL. If there is an invalid digit in the number, the longest valid
102-- prefix should be converted.
103SELECT
104  conv('123455', 3, 10),
105  conv('131', 1, 5),
106  conv('515', 5, 100),
107  conv('10', -2, 2)
108FROM src LIMIT 1
109POSTHOOK: type: QUERY
110POSTHOOK: Input: default@src
111POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1068643579/10000
1125	NULL	NULL	NULL
113PREHOOK: query: -- Perform the same tests with number arguments.
114
115SELECT
116  conv(4521, 10, 36),
117  conv(22, 10, 10),
118  conv(110011, 2, 16)
119FROM src LIMIT 1
120PREHOOK: type: QUERY
121PREHOOK: Input: default@src
122PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/877878753/10000
123POSTHOOK: query: -- Perform the same tests with number arguments.
124
125SELECT
126  conv(4521, 10, 36),
127  conv(22, 10, 10),
128  conv(110011, 2, 16)
129FROM src LIMIT 1
130POSTHOOK: type: QUERY
131POSTHOOK: Input: default@src
132POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/877878753/10000
1333HL	22	33
134PREHOOK: query: SELECT
135  conv(-641, 10, -10),
136  conv(1011, 2, -16),
137  conv(-1, 10, 16),
138  conv(-15, 10, 16)
139FROM src LIMIT 1
140PREHOOK: type: QUERY
141PREHOOK: Input: default@src
142PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1990388663/10000
143POSTHOOK: query: SELECT
144  conv(-641, 10, -10),
145  conv(1011, 2, -16),
146  conv(-1, 10, 16),
147  conv(-15, 10, 16)
148FROM src LIMIT 1
149POSTHOOK: type: QUERY
150POSTHOOK: Input: default@src
151POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1990388663/10000
152-641	B	FFFFFFFFFFFFFFFF	FFFFFFFFFFFFFFF1
153PREHOOK: query: SELECT
154  conv(9223372036854775807, 36, 16),
155  conv(9223372036854775807, 36, -16),
156  conv(-9223372036854775807, 36, 16),
157  conv(-9223372036854775807, 36, -16)
158FROM src LIMIT 1
159PREHOOK: type: QUERY
160PREHOOK: Input: default@src
161PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1540368732/10000
162POSTHOOK: query: SELECT
163  conv(9223372036854775807, 36, 16),
164  conv(9223372036854775807, 36, -16),
165  conv(-9223372036854775807, 36, 16),
166  conv(-9223372036854775807, 36, -16)
167FROM src LIMIT 1
168POSTHOOK: type: QUERY
169POSTHOOK: Input: default@src
170POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1540368732/10000
171FFFFFFFFFFFFFFFF	-1	FFFFFFFFFFFFFFFF	-1
172PREHOOK: query: SELECT
173  conv(123455, 3, 10),
174  conv(131, 1, 5),
175  conv(515, 5, 100),
176  conv('10', -2, 2)
177FROM src LIMIT 1
178PREHOOK: type: QUERY
179PREHOOK: Input: default@src
180PREHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1788821246/10000
181POSTHOOK: query: SELECT
182  conv(123455, 3, 10),
183  conv(131, 1, 5),
184  conv(515, 5, 100),
185  conv('10', -2, 2)
186FROM src LIMIT 1
187POSTHOOK: type: QUERY
188POSTHOOK: Input: default@src
189POSTHOOK: Output: file:/Users/carl/Projects/hd9/hive-trunk/build/ql/tmp/1788821246/10000
1905	NULL	NULL	NULL