My personal bet is that from the very beginning, Cassandra was more 
"number-centric" and right alignment just made more sense back then, 
considering strings as an afterthought. Another explanation is that nobody 
actually put any work to it to distinguish strings and numbers and it stayed 
like that. I can definitely see the value in left alignment for strings. Whole 
system of written "latin" language is to do it from left to right. Arabic is 
from right to left and there it makes more sense but that is imho absolute 
minority in practice so left alignment just makes more sense to me overall in 
every situation (for strings)

________________________________________
From: Derek Chen-Becker <de...@chen-becker.org>
Sent: Tuesday, January 9, 2024 17:15
To: dev@cassandra.apache.org
Subject: Re: [Discuss] CQLSH should left-align numbers, right-align text 
(CASSANDRA-19150)

EXTERNAL EMAIL - USE CAUTION when clicking links or attachments



In the ticket itself there's an example of left aligned being better for prefix 
strings (e.g. fully qualified class names), and I suspect this is similarly 
useful for other things like file paths, etc. I would also agree with Stefan 
that it would be nice to know why the current convention was chosen in the 
first place.

Cheers,

Derek

On Tue, Jan 9, 2024 at 8:18 AM Brad 
<bscho...@gmail.com<mailto:bscho...@gmail.com>> wrote:
Derek,

I'm proposing a switch or blanket change to a convention of right aligned text 
and left aligned numbers in CQLSH.

I took a look at two other examples, Excel and Postgres shell and that's how 
they work when displaying tabular data.  The Jira was originally to make right 
or left alignment an option, but making it configurable seems less useful than 
choosing a better standard.

On Tue, Jan 9, 2024 at 9:58 AM Derek Chen-Becker 
<de...@chen-becker.org<mailto:de...@chen-becker.org>> wrote:
Just to clarify, per the ticket you're proposing a configuration option to 
control this on a per-column basis, correct? Your email makes it sound like a 
blanket change.

Cheers,

Derek

On Tue, Jan 9, 2024 at 7:34 AM Brad 
<bscho...@gmail.com<mailto:bscho...@gmail.com>> wrote:
CQLSH currently left-aligns all output, affecting both numbers and text.  While 
this works well for numbers, a better approach adopted by many is to left align 
numbers and right align text.

For example, both Excel and Postgres shell use the later:


psql

# select * from employee;

 empid |  name   |    dept

-------+---------+------------

     1 | Clark   | Sales

   200 | Dave    | Accounting

    33 | Johnson | Sales

while CQLSH simply left aligns all the columns


cqlsh> select * from employee;

 empid | dept       | name

-------+------------+---------

    33 |      Sales | Johnson

     1 |      Sales |   Clark

   200 | Accounting |    Dave



Left aligned text looks much worse on text values which share common prefixes


cqlsh> select * from system_views.system_properties limit 7 ;


 name                                       | value

--------------------------------------------+--------------------------------------------

                                  JAVA_HOME |              
/Users/brad/.jenv/versions/17

                   cassandra.jmx.local.port |                                   
    7199

                           cassandra.logdir | 
/usr/local/cassandra-5.0-beta1/bin/../logs

                       cassandra.storagedir | 
/usr/local/cassandra-5.0-beta1/bin/../data

  com.sun.management.jmxremote.authenticate |                                   
   false

 com.sun.management.jmxremote.password.file |          
/etc/cassandra/jmxremote.password

    io.netty.transport.estimateSizeOnSubmit |                                   
   false



The Jira CASSANDRA-19150<https://issues.apache.org/jira/browse/CASSANDRA-19150> 
discusses this in further detail with some additional examples.


I wanted to raise the issue here to propose changing CQLSH to right-align text 
while continue to left-align numbers.


Regards,


Brad Schoening


[https://lh3.googleusercontent.com/a/ACg8ocIyewytSUXGiqiyXhMz6n1Kw3G3R_QAsy09jFQvse8HqQ=s80-p-mo]
ReplyForward

Add reaction


--
+---------------------------------------------------------------+
| Derek Chen-Becker                                             |
| GPG Key available at 
https://keybase.io/dchenbecker<https://keybase.io/dchenbecker> and       |
| 
https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org<https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org>
 |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---------------------------------------------------------------+



--
+---------------------------------------------------------------+
| Derek Chen-Becker                                             |
| GPG Key available at 
https://keybase.io/dchenbecker<https://keybase.io/dchenbecker> and       |
| 
https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org<https://pgp.mit.edu/pks/lookup?search=derek%40chen-becker.org>
 |
| Fngrprnt: EB8A 6480 F0A3 C8EB C1E7  7F42 AFC5 AFEE 96E4 6ACC  |
+---------------------------------------------------------------+

Reply via email to