[
https://issues.apache.org/jira/browse/CASSANDRA-19105?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17899641#comment-17899641
]
Brad Schoening edited comment on CASSANDRA-19105 at 11/20/24 4:54 AM:
----------------------------------------------------------------------
[~gautamg] thanks, the pytest and pycodestyle look great, and the capture
works as it should.
{_}However{_}, I was looking at the reason this odd double array indexing code
was needed
{quote}if parsed.matched[1][0] == 'identifier' and parsed.matched[1][1].upper()
== 'OFF':
{quote}
The reasons is the BNF production rule in cqlshhandling.py for CAPTURE is
poorly done because it separates the fname from the OFF value and doesn't
provide a name to bind on:
{quote}<captureCommand> ::= "CAPTURE" ( fname=( <stringLiteral>) | "OFF" )?
{quote}
Instead, this should be done switch style with two values: fname/OFF, so
{quote}<captureCommand> ::= "CAPTURE" ( switch=( <stringLiteral> | "OFF" ))?
{quote}
with this, cqlshmain can be simplified to
{color:#4c9aff}parsed.get_binding('switch'){color} and the switch value will be
either a filename, Off or None.
was (Author: bschoeni):
[~gautamg] thanks, the pytest and pycodestyle look great, and the capture
works as it should.
{_}However{_}, I was looking at the reason this odd double array indexing code
was needed
{quote}if parsed.matched[1][0] == 'identifier' and parsed.matched[1][1].upper()
== 'OFF':
{quote}
The reasons is the BNR production rule in cqlshhandling.py for CAPTURE is
poorly done because it separates the fname from the OFF value and doesn't
provide a name to bind on:
{quote}<captureCommand> ::= "CAPTURE" ( fname=( <stringLiteral>) | "OFF" )?
{quote}
Instead, this should be done switch style with two values: fname/OFF, so
{quote}<captureCommand> ::= "CAPTURE" ( switch=( <stringLiteral> | "OFF" ))?
{quote}
with this, cqlshmain can be simplified to
{color:#4c9aff}parsed.get_binding('switch'){color} and the switch value will be
either a filename, Off or None.
> Fix CQLSH Capture to save query results only and not trace details when
> Tracing is on
> -------------------------------------------------------------------------------------
>
> Key: CASSANDRA-19105
> URL: https://issues.apache.org/jira/browse/CASSANDRA-19105
> Project: Cassandra
> Issue Type: Bug
> Components: CQL/Interpreter
> Reporter: Brad Schoening
> Assignee: Gautam G
> Priority: Normal
> Attachments: test_results.txt, trunk_test_results.txt
>
>
> When using *Tracing* in CQLSH, it's sometimes helpful to use *Capture* to
> avoid paging through output when you want to see the trace results. However,
> the trace results are also incorrectly captured to the output file.
> According to *Help Capture* (below), only the query result should be saved.
> The correct behavior should display the trace results and only capture the
> query results.
> {_}Help capture message{_}: Only query result output is captured.
> Errors and output from cqlsh-only commands will still be shown in the cqlsh
> session.
> Example:
> {quote}> TRACING ON;
> > select * from system_schema.columns LIMIT 1;
> > CAPTURE 'foo'
> {quote}
> this should display only the tracing information
> {quote}> CAPTURE OFF
> {quote}
> displays results and then the tracing
> {quote}> TRACING OFF
> {quote}
> displays only the results
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]