-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FLINK-22169][sql-client] Beautify the CliTableauResultView when print #15562
Conversation
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 6d31b83 (Fri May 28 09:05:38 UTC 2021) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
@@ -132,11 +145,23 @@ private void printResults(AtomicInteger receivedRowCount, boolean isStreamingMod | |||
DEFAULT_COLUMN_WIDTH, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you check the signature of PrintUtils.columnWidthsByType
and you will see the second parameter is maxColumnWidth. DEFAULT_COLUMN_WIDTH will not be enough even for some popular data types such as TIMESTAMP(3)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reuse PrintUtils.MAX_COLUMN_WIDTH
+--------------------------+
| current_timestamp |
+--------------------------+
| 2021-04-12T08:59:24.973Z |
+--------------------------+
Received a total of 1 row
...e/flink-sql-client/src/main/java/org/apache/flink/table/client/cli/CliTableauResultView.java
Outdated
Show resolved
Hide resolved
@@ -132,11 +145,23 @@ private void printResults(AtomicInteger receivedRowCount, boolean isStreamingMod | |||
DEFAULT_COLUMN_WIDTH, | |||
PrintUtils.NULL_COLUMN, | |||
PrintUtils.ROW_KIND_COLUMN); | |||
isEndOfStream = getEndOfStreamWhenRetrieveRows(change); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why you retrieve results here and continue to retrieve results in the while loop in line#186?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because ResultRetrievalThread
is fetching data and put the data into the buffer by rows. Only the thread gets the mutex and the buffer is not full, the thread will put the row into the buffer.
When we try to read data from the ChangelogCollectResult#changeRecordBuffer
in getEndOfStreamWhenRetrieveRows
, we may read part of the final result. Therefore, we need continue reading the data in the loop until get EOS.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this, the logic you mentioned is already taken care by the codes you modified before (which only has one while loop). What I don't understand is why you split the old while loop and spread the logic of retrieving data into 3-5 places.
Continue in #15603. |
you can close this one |
What is the purpose of the change
Use
PrintUtils#columnWidthsByContent
to calculate column width in batch mode. To prevent OOM, we only retrieve part of data.Verifying this change
This change is already covered by existing tests.
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes / no)Documentation