[
https://issues.apache.org/jira/browse/CASSANDRA-19150?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17833950#comment-17833950
]
Brad Schoening edited comment on CASSANDRA-19150 at 6/3/24 12:06 PM:
---------------------------------------------------------------------
[~arkn98] Ok, I see your point.
Reviewing the code and you're question #1, I wonder if it would be tidier to
consolidate the formatting into a map like DEFAULT_VALUE_COLORS which maps
types to color formats. This could be generalized to a multi-value map for
types -> ( color, alignment).
For example:
{code:java}
TYPE_FORMATS = { 'default': (YELLOW, 'left'), 'text': (YELLOW, 'left'), 'int':
(GREEN, 'right')}
color, algn = TYPE_FORMATS['int']{code}
Since Python uses strings 'right' and 'left' in formatting, it might be more
consistent to use raw strings here instead of an enum.
#2 align by the type of the field sounds right. I checked psql and it simply
displays nulls as blanks.
#3 If default is normally left, user types and collections should probably be
left.
#4 how many tests are broken by this change?
was (Author: bschoeni):
[~arkn98] Ok, I see your point.
Reviewing the code and you're question #1, I wonder if it would be tidier to
consolidate the formatting into a map like DEFAULT_VALUE_COLORS which maps
types to color formats. This could be generalized to a multi-value map for
types -> ( color, alignment).
For example:
{code:java}
TYPE_FORMATS = { 'default': (YELLOW, 'left'), 'text': (YELLOW, 'left'), 'int':
(GREEN, 'right')}
color, algn = TYPE_FORMATS['int']{code}
Since Python uses 'right' and 'left', it might be more consistent to use raw
strings here instead of an enum.
#2 align by the type of the field sounds right. I checked psql and it simply
displays nulls as blanks.
#3 If default is normally left, user types and collections should probably be
left.
#4 how many tests are broken by this change?
> Align values in rows in CQLSH right for numbers, left for text
> --------------------------------------------------------------
>
> Key: CASSANDRA-19150
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19150
> Project: Cassandra
> Issue Type: Improvement
> Components: CQL/Interpreter
> Reporter: Stefan Miklosovic
> Assignee: Arun Ganesh
> Priority: Low
> Fix For: 5.x
>
> Attachments: Screenshot 2023-12-04 at 00.38.16.png, Screenshot
> 2023-12-09 at 16.58.25.png, signature.asc, test_output.txt,
> test_output_old.txt
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> *Updated* Jan 17 2024 after dev discussion
> Change CQLSH to left-align text while continue to right-align numbers. This
> will match how Postgres shell and Excel treat alignment of text and number.
> -------------
> *Original*
> We need to make this
> [https://github.com/apache/cassandra/blob/trunk/pylib/cqlshlib/cqlshmain.py#L1101]
> configurable so values in columns are either all on left or on right side of
> the column (basically change col.rjust to col.ljust).
> By default, it would be like it is now but there would be configuration
> property in cqlsh for that as well as a corresponding CQLSH command
> (optional), something like
> {code:java}
> ALIGNMENT LEFT|RIGHT
> {code}
> cc [~bschoeni]
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]