You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2022/06/02 09:38:00 UTC

[jira] [Commented] (IMPALA-11332) impala-shell strips trailing whitespace from csv output

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

ASF subversion and git services commented on IMPALA-11332:
----------------------------------------------------------

Commit c41e6941cafad453819b57e78b2083a3e64496e0 in impala's branch refs/heads/master from Joe McDonnell
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=c41e6941c ]

IMPALA-11332: Fix trailing whitespace for CSV output

The current CSV output is stripping trailing
whitespaces from the last line of CSV output. This
rstrip() was intended to remove an extra newline,
but it is matching other white space. This is a
problem for a SQL query like:
select 'Trailing whitespace          ';

This changes the rstrip() to rstrip('\n') to
avoid removing the other white space.

Testing:
 - Current shell tests pass
 - Added a shell test that verifies trailing whitespace
   is not being stripped.

Change-Id: I69d032ca2f581587b0938d0878fdf402fee0d57e
Reviewed-on: http://gerrit.cloudera.org:8080/18580
Reviewed-by: Quanlong Huang <hu...@gmail.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> impala-shell strips trailing whitespace from csv output
> -------------------------------------------------------
>
>                 Key: IMPALA-11332
>                 URL: https://issues.apache.org/jira/browse/IMPALA-11332
>             Project: IMPALA
>          Issue Type: Bug
>          Components: Clients
>    Affects Versions: Impala 4.2.0
>            Reporter: Joe McDonnell
>            Priority: Critical
>
> A query like this should have trailing whitespace in the impala-shell output:
>  
> {noformat}
> impala-shell -B -q 'select "TEST NODE: Creating table       "'
> Starting Impala Shell with no authentication using Python 3.6.9
> Warning: live_progress only applies to interactive shell sessions, and is being skipped for now.
> Opened TCP connection to localhost:21050
> Connected to localhost:21050
> Server version: impalad version 4.1.0-SNAPSHOT DEBUG (build 730b7addb84839f2aebf63af501cc9e626f0d1c8)
> Query: select "TEST NODE: Creating table       "
> Query submitted at: 2022-06-01 12:37:58 (Coordinator: http://joemcdonnell:25000)
> Query progress can be monitored at: http://joemcdonnell:25000/query_plan?query_id=3743cf7e04b44e18:5ee28b3b00000000
> TEST NODE: Creating table <----- whitespace should exist here
> Fetched 1 row(s) in 0.11s{noformat}
> This is due to this rstrip() call here:
>  
> [https://github.com/apache/impala/blob/master/shell/shell_output.py#L93]
>  
> {noformat}
>     for row in rows:
>       if sys.version_info.major == 2:
>         row = [val.encode('utf-8', 'replace') if isinstance(val, unicode) else val
>             for val in row]
>       writer.writerow(row)
>     rows = temp_buffer.getvalue().rstrip() <--------
>     temp_buffer.close()
>     return rows{noformat}
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org