Search code examples
druid

Druid Concat String and Measure aggregation


I am using CONCAT method in druid to prepend currency symbol to the total amount write the expression. Ideally, the columns "Total amount with currency" and "Total amount" should have the same value in the below query.

select TRUNCATE(SUM("Amount"),2) "Total amount", CONCAT('$ ', TRUNCATE(SUM("Amount"),2) ) "Total amount with currency" from salestable

In the result set, "Total amount" is coming as 66062139678.12 whereas for "Total amount with currency" it is coming as $ 6.606213967812E10

I am wondering if there is a different expression to achieve this or if there is something fundamentally wrong with the CONCAT implementation used by me. The same query, when used in MySQL, works just fine.

The problem might be related to casting of data which I am unsure of on how to resolve.


Solution

  • CONCAT was the wrong usage here. We got it sorted using

    select STRING_FORMAT('$ %f', SUM(Amount)) "Total amount with currency" from salestable