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

Arun Ganesh edited comment on CASSANDRA-19150 at 3/18/24 12:33 PM:
-------------------------------------------------------------------

Additionally,
 # I noticed some deadcode. There are multiple places with code like this,
{code:java}
return bval if colormap is NO_COLOR_MAP else ...
{code}
When the {{--no-color}} flag is passed, or the tty is "dumb", we do this
{code:python}
if addcolor is False:
    colormap = empty_colormap
{code}
where {{{}empty_colormap = defaultdict(lambda: ''){}}}. The {{NO_COLOR_MAP}} is 
just a plain {{{}dict(){}}}.
{{colormap is NO_COLOR_MAP}} will always be {{{}False{}}}.
{code:python}
$ python3
Python 3.8.18 (default, Dec 16 2023, 04:10:16)
>>> from collections import defaultdict
>>> a = defaultdict(lambda: '')
>>> b = dict()
>>> a is b
False{code}
 # I found two formatter functions for the `duration` type. Is there a 
difference between `Duration` and `duration`?
{code:python}
formatter_for('duration')(format_integer_type)
.
.
.
@formatter_for('Duration')
def format_value_duration(val, colormap, **_):
    return format_python_formatted_type(duration_as_str(val.months, val.days, 
val.nanoseconds), colormap, 'duration'){code}
The second one is picked up always.


was (Author: JIRAUSER303038):
Additionally,
 # I noticed some deadcode. There are multiple places with code like this,
{code:java}
return bval if colormap is NO_COLOR_MAP else ...
{code}
When the {{--no-color}} flag is passed, or the tty is "dumb", we do this
{code:python}
if addcolor is False:
    colormap = empty_colormap
{code}
where {{{}empty_colormap = defaultdict(lambda: ''){}}}. The {{NO_COLOR_MAP}} is 
just a plain {{{}dict(){}}}.
{{colormap is NO_COLOR_MAP}} will always be {{{}False{}}}.
{code:python}
$ python3
Python 3.8.18 (default, Dec 16 2023, 04:10:16)
>>> from collections import defaultdict
>>> a = defaultdict(lambda: '')
>>> b = dict()
>>> a is b
False{code}

 # I found two formatter functions for the `duration` type. Is there a 
difference between `Duration` and `duration`?
{code:python}
formatter_for('duration')(format_integer_type)
.
.
.
@formatter_for('Duration')
def format_value_duration(val, colormap, **_):
    return format_python_formatted_type(duration_as_str(val.months, val.days, 
val.nanoseconds), colormap, 'duration'){code}
The second one is picked up always.

> 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
>
>          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: commits-unsubscr...@cassandra.apache.org
For additional commands, e-mail: commits-h...@cassandra.apache.org

Reply via email to