Search code examples
hivehql

Hive CAST to BIGINT returns null


I need to convert it to biginteger as I need to XOR the same with another biginteger(123456789123) in my hive result.

select cast("18072662652752953069" as bigint);

returns NULL;

Am I missing something here.


Solution

  • It returns NULL simply because you have supplied a number that is greater than the largest number that bigint can represent.

    As per this Language Manual

    BIGINT (8-byte signed integer, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807)