Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

fsk119
Copy link
Member

@fsk119 fsk119 commented Apr 12, 2021

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:

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (yes / no)
  • The serializers: (yes / no / don't know)
  • The runtime per-record code paths (performance sensitive): (yes / no / don't know)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (yes / no / don't know)
  • The S3 file system connector: (yes / no / don't know)

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 12, 2021

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit 6d31b83 (Fri May 28 09:05:38 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@@ -132,11 +145,23 @@ private void printResults(AtomicInteger receivedRowCount, boolean isStreamingMod
DEFAULT_COLUMN_WIDTH,
Copy link
Contributor

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)

Copy link
Member Author

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

@@ -132,11 +145,23 @@ private void printResults(AtomicInteger receivedRowCount, boolean isStreamingMod
DEFAULT_COLUMN_WIDTH,
PrintUtils.NULL_COLUMN,
PrintUtils.ROW_KIND_COLUMN);
isEndOfStream = getEndOfStreamWhenRetrieveRows(change);
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

@flinkbot
Copy link
Collaborator

flinkbot commented Apr 12, 2021

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

@fsk119
Copy link
Member Author

fsk119 commented Apr 14, 2021

Continue in #15603.

@KurtYoung
Copy link
Contributor

you can close this one

@fsk119 fsk119 closed this Apr 14, 2021
@fsk119 fsk119 deleted the beautfiy-tableau-print branch September 26, 2022 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants