u6765
u6765

Reputation: 113

Casting string to integer gives NULL values in spark sql

%sql 
select int('00000282001368')

gives me 282001368 which is correct, when I do the same thing for below string it gives me NULL

%sql
select int('00012300000079')

gives me NULL

How to get the Integer in the second scenario?

Thanks in advance

Upvotes: 2

Views: 1745

Answers (1)

Mohana B C
Mohana B C

Reputation: 5487

You should use bigint. Second one is not in int range.

select bigint('00012300000079')

Upvotes: 2

Related Questions