You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/01/17 00:49:19 UTC

[GitHub] kristw opened a new pull request #6709: Add more format shims

kristw opened a new pull request #6709: Add more format shims
URL: https://github.com/apache/incubator-superset/pull/6709
 
 
   During migration from old formatter to new formatter, we notice difference in formatted output. Previous PR #6470  adds shim for the format strings that are considered invalid formats by the new formatter.
   
   This PR add shims for format strings that are ambiguous, but are still treated as valid format string in `d3-format` and produce different results from old formatter. Only format strings with >=20 occurrences with quite clear intent of what the format string means are shimmed. 
   
   In the near future, these shims will be removed and fixed with a one-time `db:migration`.
   
   @michellethomas 
   
   ### Appendix
   
   See format string usage statistics below:
   
   format string | count | `d3.format` (v3) | `@superset-ui/number-format`, which is based on `d3-format` (v4)
   ---|---|---|---
   ""|28252|12345.6789|12.3k
   "d"|605||12346
   ",0"|528|12,345.6789|12345.6789 (Invalid format: ,0)
   "null"|455|12,345.6789|12.3k
   "%"|245|1234568%|1234567.890000%
   ""|187|12345.6789|12.3k
   "."|152|12345.6789|12345.6789 (Invalid format: .)
   ",f"|135|12,346|12,345.678900
   ",r"|99|12,345.6789|12,345.7
   "0f"|87|12346|12345.678900
   ",#"|83|12,345.6789|12345.6789 (Invalid format: ,#)
   "$,f"|66|$12,346|$12,345.678900
   ",2f"|59|12,345.6789|12345.6789 (Invalid format: ,2f)
   ", \| 12"|54|12,345.6789|12345.6789 (Invalid format: , \| 12)
   "0%"|50|1234568%|1234567.890000%
   "f"|48|12346|12345.678900
   ".g"|45|12345.6789|12345.6789 (Invalid format: .g)
   "int"|41|12345.6789|12345.6789 (Invalid format: int)
   ",."|39|12,345.6789|12345.6789 (Invalid format: ,.)
   "1%"|39|1234568%|1234567.890000%
   ",d"|37||12,346
   ".1%f"|34|1234567.9%|12345.6789 (Invalid format: .1%f)
   "3%"|33|1234568%|1234567.890000%
   ",%"|30|1,234,568%|1,234,567.890000%
   ".r"|28|12345.6789|12345.6789 (Invalid format: .r)
   "aggregate"|26|12345.6789|12345.6789 (Invalid format: aggregate)
   "r"|25|12345.6789|12345.7
   "0s"|25|12.345678900000001k|12.3457k
   "$,.1"|23|$12,345.6789|$1e+4
   ",0s"|23|12,345.6789|12345.6789 (Invalid format: ,0s)
   "s"|21|12.345678900000001k|12.3457k
   "%%%"|21|1234568%|12345.6789 (Invalid format: %%%)
   ",0f"|20|12,345.6789|12345.6789 (Invalid format: ,0f)
   "\"s\"|18|12345.6789|12345.6789 (Invalid format: \"s\)
   ",1"|17|12,345.6789|12345.6789 (Invalid format: ,1)
   ".0"|16|12345.6789|1e+4
   ",r \| 12"|15|12,345.6789|12345.6789 (Invalid format: ,r \| 12)
   "$.3s \| 12.3k"|14|$12.3k|12345.6789 (Invalid format: $.3s \| 12.3k)
   "+,%"|13|+1,234,568%|+1,234,567.890000%
   "$f"|13|$12346|$12345.678900
   ",.0"|13|12,345.6789|1e+4
   "$.2s "|13|$12k|12345.6789 (Invalid format: $.2s )
   "$,.0"|12|$12,345.6789|$1e+4
   "$0f"|12|$12346|$12345.678900
   "1%f"|12|1234568%|12345.6789 (Invalid format: 1%f)
   "%,.2s"|10|1234568%|12345.6789 (Invalid format: %,.2s)
   ".0%f"|10|1234568%|12345.6789 (Invalid format: .0%f)
   ".1"|9|12345.6789|1e+4
   ",4r"|9|12,345.6789|12345.6789 (Invalid format: ,4r)
   "0,f"|9|12,346|12,345.678900
   "$,0"|9|$12,345.6789|12345.6789 (Invalid format: $,0)
   "$,0f"|8|$12,345.6789|12345.6789 (Invalid format: $,0f)
   "3d"|8||12346
   "$,.f"|7|$12,345.6789|12345.6789 (Invalid format: $,.f)
   "$1f"|7|$12346|$12345.678900
   ",.4"|6|12,345.6789|1.235e+4
   "$,1f"|6|$12,345.6789|12345.6789 (Invalid format: $,1f)
   "$,4r"|6|$12,345.6789|12345.6789 (Invalid format: $,4r)
   "0.1%f"|6|1234567.9%|12345.6789 (Invalid format: 0.1%f)
   "00%"|6|1234568%|1234567.890000%
   "%,.3s"|6|1234568%|12345.6789 (Invalid format: %,.3s)
   "+.3s \| 12.3k"|6|+12.3k|12345.6789 (Invalid format: +.3s \| 12.3k)
   ",0r"|6|12,345.6789|12345.6789 (Invalid format: ,0r)
   "%.1f"|6|1234568%|12345.6789 (Invalid format: %.1f)
   ".s"|5|12345.6789|12345.6789 (Invalid format: .s)
   ",.1"|4|12,345.6789|1e+4
   ", \| 123"|4|12,345.6789|12345.6789 (Invalid format: , \| 123)
   ".2"|3|12345.6789|1.2e+4
   "%m/%d/%y/01/01/2019"|3|1234568%|12345.6789 (Invalid format: %m/%d/%y/01/01/2019)
   ",0.f"|3|12,345.6789|12345.6789 (Invalid format: ,0.f)
   ".1f\|12345.1"|3|12345.7|12345.6789 (Invalid format: .1f\|12345.1)
   ", 0"|3|12,345.6789|12345.6789 (Invalid format: , 0)
   "%     "|3|1234568%|12345.6789 (Invalid format: %     )
   "0"|3|12345.6789|12.3k
   ",6r"|3|12,345.6789|12345.6789 (Invalid format: ,6r)
   ".d"|3|12345.6789|12345.6789 (Invalid format: .d)
   ".0% "|3|1234568%|12345.6789 (Invalid format: .0% )
   "%.0"|3|1234568%|12345.6789 (Invalid format: %.0)
   ".2f \| x"|3|12345.68|12345.6789 (Invalid format: .2f \| x)
   ",.f"|3|12,345.6789|12345.6789 (Invalid format: ,.f)
   "% \| 123"|3|1234568%|12345.6789 (Invalid format: % \| 123)
   "$,s"|2|$12.345678900000001k|$12.3457k
   "r \| 12340"|2|12345.6789|12345.6789 (Invalid format: r \| 12340)
   "%.1"|2|1234568%|12345.6789 (Invalid format: %.1)
   "%3s"|2|1234568%|12345.6789 (Invalid format: %3s)
   ":0.2f"|2|12345.6789|12345.6789 (Invalid format: :0.2f)
   "1.f"|2|12345.6789|12345.6789 (Invalid format: 1.f)
   "$,3s"|2|$12,345.6789|12345.6789 (Invalid format: $,3s)
   ",.0d"|2||12,346
   ".3s   "|2|12.3k|12345.6789 (Invalid format: .3s   )
   "0.123"|2|12345.6789|12345.6789000000007945
   "\| 12,121"|2|12345.6789|12345.6789 (Invalid format: \| 12,121)
   "$.4s \| 12.3k"|2|$12.35k|12345.6789 (Invalid format: $.4s \| 12.3k)
   "0.4s \| 12.3M"|2|12.35k|12345.6789 (Invalid format: 0.4s \| 12.3M)
   ", r"|2|12,345.6789|12345.6789 (Invalid format: , r)
   "2%"|2|1234568%|1234567.890000%
   ".2s \| 12K"|2|12k|12345.6789 (Invalid format: .2s \| 12K)
   "$.3s \| 12.3K"|2|$12.3k|12345.6789 (Invalid format: $.3s \| 12.3K)
   ".1% \|"|2|1234567.9%|12345.6789 (Invalid format: .1% \|)
   "$,."|2|$12,345.6789|12345.6789 (Invalid format: $,.)
   ",.f0"|2|12,345.6789|12345.6789 (Invalid format: ,.f0)
   "\".0%\"|1|12345.6789|12345.6789 (Invalid format: \".0%\)
   ",5r"|1|12,345.6789|12345.6789 (Invalid format: ,5r)
   "0min"|1|12345.6789|12345.6789 (Invalid format: 0min)
   "".0r"|1|12345.6789|12345.6789 (Invalid format: ".0r)
   "0.12345"|1|12345.6789|12345.6789000000007945
   "$,.2f \| $12,000"|1|$12,345.68|12345.6789 (Invalid format: $,.2f \| $12,000)
   "$,\|$123"|1|$12,345.6789|12345.6789 (Invalid format: $,\|$123)
   "$.3s (12345.432 => $12.3k)"|1|$12.3k|12345.6789 (Invalid format: $.3s (12345.432 => $12.3k))
   "$.0"|1|$12345.6789|$1e+4
   ".1s%"|1|10k|12345.6789 (Invalid format: .1s%)
   "1234.5k"|1|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        12345.6789|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             12346
   ".3% "|1|1234567.890%|12345.6789 (Invalid format: .3% )
   "$d"|1||$12346
   "%2r"|1|1234568%|12345.6789 (Invalid format: %2r)
   ".1% \| 123.1%"|1|1234567.9%|12345.6789 (Invalid format: .1% \| 123.1%)
   " \| 12,320"|1| 12345.6789|12345.6789 (Invalid format:  \| 12,320)
   "2f"|1|12346|12345.678900
   "0"|1|12345.6789|12.3k
   "0r"|1|12345.6789|12345.7
   ",00"|1|12,345.6789|12345.6789 (Invalid format: ,00)
   ".1%%"|1|1234567.9%|12345.6789 (Invalid format: .1%%)
   "Adaptive formating"|1|12345.6789|12345.6789 (Invalid format: Adaptive formating)
   "1,f"|1|12,346|12,345.678900
   ".2f x"|1|12345.68|12345.6789 (Invalid format: .2f x)
   "$,fs"|1|$12,346|12345.6789 (Invalid format: $,fs)
   "$,.3K"|1|$12,345.6789|$1.23e+4
   "100%"|1|                                                                                             1234568%|                                                                                     1234567.890000%
   ". "|1|12345.6789|12345.6789 (Invalid format: . )
   ".2fs+\"X\"|1|12345.68|12345.6789 (Invalid format: .2fs+\"X\)
   ".3s "|1|12.3k|12345.6789 (Invalid format: .3s )
   "0.1234"|1|12345.6789|12345.6789000000007945
   ".3M"|1|12345.6789|1.23e+4
   ",3r"|1|12,345.6789|12345.6789 (Invalid format: ,3r)
   "%,0s"|1|1234568%|12345.6789 (Invalid format: %,0s)
   ".3f x"|1|12345.679|12345.6789 (Invalid format: .3f x)
   "12,345"|1| 12,345.6789|12345.6789 (Invalid format: 12,345)
   ".3% \| 12.34%"|1|1234567.890%|12345.6789 (Invalid format: .3% \| 12.34%)
   ".2r X"|1|12000|12345.6789 (Invalid format: .2r X)
   ".1% \| 123"|1|1234567.9%|12345.6789 (Invalid format: .1% \| 123)
   ".1% \| 123%"|1|1234567.9%|12345.6789 (Invalid format: .1% \| 123%)
   ".3s\|12k"|1|12.3k|12345.6789 (Invalid format: .3s\|12k)
   ".0% \|"|1|1234568%|12345.6789 (Invalid format: .0% \|)
   "%0"|1|1234568%|12345.6789 (Invalid format: %0)
   "1s"|1|12.345678900000001k|12.3457k
   ".f"|1|12345.6789|12345.6789 (Invalid format: .f)
   ".1% \| 100.0%"|1|1234567.9%|12345.6789 (Invalid format: .1% \| 100.0%)
   "\".1%\"|1|12345.6789|12345.6789 (Invalid format: \".1%\)
   ".3% \| 123456.00%"|1|1234567.890%|12345.6789 (Invalid format: .3% \| 123456.00%)
   ".1% "|1|1234567.9%|12345.6789 (Invalid format: .1% )
   "*.0s"|1|12345.6789|12345.6789 (Invalid format: *.0s)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org