Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

Inverse of function bin

avatar
Contributor

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

1 ACCEPTED SOLUTION

avatar
Super Collaborator

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.

View solution in original post

2 REPLIES 2

avatar

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

avatar
Super Collaborator

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.