Suppose I have a string like '00321'
and I want to convert it into a BIGINT
in Hive, how would I do it?
Follow-up question: would the resulting BIGINT
value be 321
or 00321
?
You can use the CAST
function to cast your STRING
to a BIGINT
, like so:
SELECT CAST('00321' AS BIGINT) FROM table;
As a BIGINT
it will show on the screen and in delimited text files as 321
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With