[ https://issues.apache.org/jira/browse/IMPALA-11337?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17577031#comment-17577031 ]
ASF subversion and git services commented on IMPALA-11337: ---------------------------------------------------------- Commit 328eedf96725c1eafd29675eea89b72990a06d15 in impala's branch refs/heads/branch-4.1.1 from Joe McDonnell [ https://gitbox.apache.org/repos/asf?p=impala.git;h=328eedf96 ] IMPALA-11337: Flush row output before writing "Fetched X row(s)" When redirecting stdout and stderr to a file, the existing code can sometimes output the "Fetched X row(s)" line before finishing the row output. e.g. impala-shell -B -q "select 1" >> outfile.txt 2>> outfile.txt The rows output goes to stdout while the control messages like "Fetched X row(s)" go to stderr. Since stdout can buffer output, that can delay the output. This adds a flush for stdout before writing the "Fetched X row(s)" message. Testing: - Added a shell test that redirects stdout and stderr to a file and verifies the contents. This consistently fails without the flush. - Other shell tests pass Change-Id: I83f89c110fd90d2d54331c7121e407d9de99146c Reviewed-on: http://gerrit.cloudera.org:8080/18625 Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com> > impala-shell can output the "Fetched X row(s)" line before the actual results > ----------------------------------------------------------------------------- > > Key: IMPALA-11337 > URL: https://issues.apache.org/jira/browse/IMPALA-11337 > Project: IMPALA > Issue Type: Bug > Components: Clients > Affects Versions: Impala 4.2.0 > Reporter: Joe McDonnell > Assignee: Joe McDonnell > Priority: Major > Fix For: Impala 4.2.0 > > > In some scenarios, we are seeing that the "Fetched X row(s)" message is > output before the actual data: > {noformat} > Query: SELECT * FROM test_table ORDER BY id DESC > Query submitted at: 2022-06-02 23:53:48 (Coordinator: > https://coordinator:25000) > Query progress can be monitored at: > https://coordinator:25000/query_plan?query_id=9d47858d6659cb87:2ccbdcdf00000000 > Fetched 1 row(s) in 1.59s > 0 john 10{noformat} > The "Fetched X row(s)" message is going to stderr and the results are going > to stdout, so this is not covered completely by the current tests. > Nonetheless, we should expect the "Fetched X row(s)" output to happen after > the results data is written. > We should add tests for this case and make sure that stdout is flushed prior > to writing the "Fetched X row(s)" output. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-all-unsubscr...@impala.apache.org For additional commands, e-mail: issues-all-h...@impala.apache.org