bschoening commented on code in PR #4750:
URL: https://github.com/apache/cassandra/pull/4750#discussion_r3106009279
##########
pylib/cqlshlib/cqlshmain.py:
##########
@@ -1009,7 +1016,11 @@ def print_static_result(self, result, table_meta,
with_header, tty, row_count_of
formatted_values = [list(map(self.myformat_value, [row[c] for c in
column_names], cql_types)) for row in result.current_rows]
- if self.expand_enabled:
+ if self.mode == 'csv':
Review Comment:
Output formatting should probably move to displaying.py instead of
cqlshmain. Rather than if-then-else, it would probably make sense to create a
class like TablePrinter with subclasses for TabularTablePrinter,
JsonTablePrinter, CsvTablePrinter.
##########
pylib/cqlshlib/test/test_cqlsh_output.py:
##########
@@ -1017,3 +1017,35 @@ def test_quoted_output_text_in_udts(self):
tty=False, input=query)
self.assertEqual(0, result)
self.assertEqual(output.splitlines()[3].strip(), "{data: 'I''m newb'}")
+
+ def test_csv_output(self):
Review Comment:
Unit tests should include all data types and include corner cases.
- How is the number 10,000 formatted in CVS? The name "Smith, Joe" in CSV?
- The set "{a, b, c}" in JSON?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]