You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/01/09 13:32:43 UTC

[GitHub] [druid] FrankChen021 commented on pull request #10635: Add SQL functions to format numbers into human readable format

FrankChen021 commented on pull request #10635:
URL: https://github.com/apache/druid/pull/10635#issuecomment-757192914


   
   > 
   > * IMO the name `decimal_format` is misleading. It sounds like a function that will format a number to a specific amount of decimals. Maybe instead we could call it `human_readable_decimal_format`. For consistency it may then be nice to call the others `human_readable_binary_byte_format` and `human_readable_decimal_byte_format`. The function names are long, but I think that's probably better than being misleading. Any thoughts @FrankChen021, @abhishekagarwal87, @clintropolis?
   
   Naming is really a big challenge in the world of programming :) . There're some ways listed as follows
   
   * Alternative 1 - One function with different format specifier
    format(number, 'human_readable_bin_byte')
    format(number, 'human_readable_dec_byte')
    format(number, 'human_readable_decimal')
   
   It looks like the parameters are still too long.
   
   * Alternative 2 - One function with abbreviated format specifier
   format(number, 'si') -- si is the standard word for binary byte.
   format(number, 'iec') -- iec is the standard word for decimal byte
   format(number, 'dec') 
   
   If we want to design one function, the challenge is how to give nice names for format specifiers. But it also leaves the extensibility in the future to support other kinds of number format. Do you have nicer format specifier names ?
   
   * Alternative 3 - based on @gianm 's suggestion
   human_readable_format_bin_byte
   human_readable_format_dec_byte
   human_readable_format_dec
   
   I think I would prefer the 3rd here. What do you think ? @gianm @clintropolis @abhishekagarwal87 ?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org