[ 
https://issues.apache.org/jira/browse/CASSANDRA-19546?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17915777#comment-17915777
 ] 

Stefan Miklosovic commented on CASSANDRA-19546:
-----------------------------------------------

[CASSANDRA-19546|https://github.com/instaclustr/cassandra/tree/CASSANDRA-19546]
{noformat}
java17_pre-commit_tests                         
  ✓ j17_build                                         4m 6s
  ✓ j17_cqlsh_dtests_py311                           6m 45s
  ✓ j17_cqlsh_dtests_py38                            7m 15s
  ✓ j17_cqlsh_dtests_py38_vnode                      7m 39s
  ✓ j17_cqlshlib_cython_tests                        8m 38s
  ✓ j17_cqlshlib_tests                               6m 56s
  ✓ j17_jvm_dtests_latest_vnode                     15m 20s
  ✓ j17_unit_tests                                   15m 7s
  ✓ j17_unit_tests_repeat                           14m 27s
  ✓ j17_utests_latest                               15m 46s
  ✓ j17_utests_latest_repeat                        12m 17s
  ✓ j17_utests_oa_repeat                            11m 34s
  ✕ j17_cqlsh_dtests_py311_vnode                     8m 59s
      cqlsh_tests.test_cqlsh_copy.TestCqlshCopy 
test_bulk_round_trip_with_timeouts
  ✕ j17_dtests                                      45m 56s
      compaction_test.TestCompaction test_compaction_throughput
      refresh_test.TestRefresh test_refresh_deadlock_startup
  ✕ j17_dtests_latest                                40m 0s
      read_repair_test.TestSpeculativeReadRepair test_failed_read_repair
      read_repair_test.TestSpeculativeReadRepair test_normal_read_repair
      read_repair_test.TestSpeculativeReadRepair test_quorum_requirement
      read_repair_test.TestSpeculativeReadRepair test_speculative_write
  ✕ j17_dtests_vnode                                41m 25s
      compaction_test.TestCompaction test_compaction_throughput
  ✕ j17_jvm_dtests                                  19m 47s
      org.apache.cassandra.fuzz.ring.ConsistentBootstrapTest 
coordinatorIsBehindTest
      org.apache.cassandra.distributed.test.ReadSpeculationTest speculateTest
  ✕ j17_utests_oa                                   15m 33s
      org.apache.cassandra.db.commitlog.CommitlogShutdownTest 
testShutdownWithPendingTasks                            
{noformat}

[java17_pre-commit_tests|https://app.circleci.com/pipelines/github/instaclustr/cassandra/5241/workflows/c8bd495e-06aa-480d-9eb4-4613c5b4300f]


> Add to_human_size and to_human_duration function
> ------------------------------------------------
>
>                 Key: CASSANDRA-19546
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-19546
>             Project: Apache Cassandra
>          Issue Type: New Feature
>          Components: Legacy/CQL
>            Reporter: Stefan Miklosovic
>            Assignee: Cheng Wang
>            Priority: Normal
>             Fix For: 5.x
>
>          Time Spent: 3h 50m
>  Remaining Estimate: 0h
>
> There are cases (e.g in our system_views tables but might be applicable for 
> user tables as well) when a column is of a type which represents number of 
> bytes. However, it is quite hard to parse a value for a human to have some 
> estimation what that value is.
> I propose this:
> {code:java}
> cqlsh> select * from myks.mytb ;
>  id | col1 | col2 | col3 | col4     
> ----+------+------+------+----------
>   1 |  100 |  200 |  300 | 32432423 
> (1 rows)
> cqlsh> select to_human_size(col4) from myks.mytb where id = 1;
>  system.to_human_size(col4)
> ----------------------
>             30.93 MiB
> (1 rows)
> cqlsh> select to_human_size(col4,0) from myks.mytb where id = 1;
>  system.to_human_size(col4, 0)
> -------------------------
>                   31 MiB
> (1 rows)
> cqlsh> select to_human_size(col4,1) from myks.mytb where id = 1;
>  system.to_human_size(col4, 1)
> -------------------------
>                 30.9 MiB
> (1 rows)
> {code}
> The second argument is optional and represents the number of decimal places 
> (at most) to use. Without the second argument, it will default to 
> FileUtils.df which is "#.##" format.
> {code}
> cqlsh> DESCRIBE myks.mytb ;
> CREATE TABLE myks.mytb (
> id int PRIMARY KEY,
> col1 int,
> col2 smallint,
> col3 bigint,
> col4 varint,
> )
> {code}
> I also propose that this to_human_size function (name of it might be indeed 
> discussed and it is just a suggestion) should be only applicable for int, 
> smallint, bigint and varint types. I am not sure how to apply this to e.g. 
> "float" or similar. As I mentioned, it is meant to convert just number of 
> bytes, which is just some number, to a string representation of that and I do 
> not think that applying that function to anything else but these types makes 
> sense.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to