Created on 02-21-2017 08:21 AM - edited 09-16-2022 04:07 AM
Hello,
I have a string like "0010011" and I want to convert it to int. It is the inverse of function
bin(a int)
I think
cast("0010011" as binary)
Doesn't exists
How can I do that?
Regards,
Joaquín Silva
Created on 02-22-2017 01:43 PM - edited 02-22-2017 01:45 PM
I just saw this thread after commenting on the Jira. Would "conv()" be a suitable workaround here?
select conv('100010', 2, 10); +-----------------------+ | conv('100010', 2, 10) | +-----------------------+ | 34 | +-----------------------+ Fetched 1 row(s) in 0.24s
Edit: To make things complete, the Jira is IMPALA-4968.
Created 02-21-2017 09:47 PM
Hi Joaqin,
reasonable request. Could you please file a JIRA for this new feature?
It woud be great if someone from the community can pick this up!
Thanks.
Alex
Created on 02-22-2017 01:43 PM - edited 02-22-2017 01:45 PM
I just saw this thread after commenting on the Jira. Would "conv()" be a suitable workaround here?
select conv('100010', 2, 10); +-----------------------+ | conv('100010', 2, 10) | +-----------------------+ | 34 | +-----------------------+ Fetched 1 row(s) in 0.24s
More information on conv() can be found in the Impala documentation.
Edit: To make things complete, the Jira is IMPALA-4968.
More information on conv() can be found in the Impala documentation.