I think we might still have two functions.

The first one, format, as you just showed, which would copy the behaviour
in MySQL as closely as possible.

The second one would deal with sizes, like "format_size", which would
append size unit, as shown in the branch I posted.

WDYT?

Regards

On Thu, Apr 11, 2024 at 6:09 AM Brad <bscho...@gmail.com> wrote:

> It's a useful idea and something supported in other databases.
>
> MySQL has FORMAT function:
>
> FORMAT(X,D[,locale])
>
>
> Formats the number X to a format like '#,###,###.##', rounded to D decimal
> places, and returns the result as a string. If D is 0, the result has no
> decimal point or fractional part. If X or D is NULL, the function returns
> NULL.FORMAT(X,D[,locale])
>
>
>
> ex:
>
>
> SELECT FORMAT(250500.5634, 2);
>
> 250,500.56
>
>
> SELECT FORMAT(250500.5634,0);
>
> 250,500
>
>
>
> https://dev.mysql.com/doc/refman/8.0/en/string-functions.html#function_format
>
>
> On Tue, Apr 9, 2024 at 8:10 AM Štefan Miklošovič <
> stefan.mikloso...@gmail.com> wrote:
>
>> Hi,
>>
>> I want to propose CASSANDRA-19546. It would be possible to convert raw
>> numbers to something human-friendly.
>> There are cases when we write just a number of bytes in our system tables
>> but these numbers are just hard to parse visually. Users can indeed use
>> this for their tables too if they find it useful.
>>
>> Also, a user can indeed write a UDF for this but I would prefer if we had
>> something baked in.
>>
>> Does this make sense to people? Are there any other approaches to do
>> this?
>>
>> https://issues.apache.org/jira/browse/CASSANDRA-19546
>> https://github.com/apache/cassandra/pull/3239/files
>>
>> Regards
>>
>

Reply via email to