Welcome to the Cloudera Community

Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Who agreed with this topic

Number Formatting in Impala?

avatar
Expert Contributor

Using CDH 5.2.0.

 

Is it possible to add thousand separators in query outputs (possibly converting to String), e.g., , convert 1234567 to 1,234,567?

 

Hive function number_format() seems doing the job. But it seems not available in Impala.

 

It seems to be defined in UDF. But I also can't make UDF work in Impala. There is a Hive UDF sample in http://www.cloudera.com/content/cloudera/en/documentation/cloudera-impala/latest/topics/impala_udf.h... . However I don't have hive.jar and org.apache.hadoop.hive.ql.udf.UDFOPNegative. The closest I can find is hive-exec.jar, which contains org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNegative.

 

Calling such UDF causes error:

 

create function my_neg(bigint, bigint) returns string location '/user/impala/hive-exec.jar'

symbol='org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNegative';

 

select my_neg(1234567,0);

 

Bad status for request 1008: TGetOperationStatusResp(status=TStatus(errorCode=None, errorMessage=None, sqlState=None, infoMessages=None, statusCode=0), operationState=5, errorMessage=None, sqlState=None, errorCode=None)
ClassCastException: class org.apache.hadoop.hive.ql.udf.generic.GenericUDFOPNegative

 

 

Who agreed with this topic