Let's say I have a datasource containing some purchases.
In all these purchases, I have a total amount in a particular currency.
My users would like to get the amount in their local currency.
I could see two ways to achieve that :
- add in my datasource all the converted amounts.
- calculate the asked currency amount on-the-fly
Is that even possible in Druid ? What would be the best way to do that ? Will that be efficient ?
Currencies and their equivalent currency values do keep changing. So if I have purchased an item on Jan 1 2019 for CAD 100 then I should know what was the USD value for CAD at that time. In such case you want to keep a local currency value stored so you don’t have to find currency rate of that date and compute it on the fly.
Thanks for your reply.
Actually, we don’t need to keep currency rate evolution. The rates we have is calculated every year and is valid for all previous years.
Anyway, even if it is not a good use case, is there any possibilty to calculate a value on the fly ?
You can do both; aggregation during ingestion and during query time. Doing it during ingestion time can definitely improve your final query performance (even if by slightest) but I think the overhead during the ingestion would be more.
Another option could be doing a lookup all the way at the end like post aggregation.