Posts: 46
Registered: ‎11-03-2014

Number Formatting in Impala?

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 . 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'



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