Skip to content

Conversation

snuyanzin
Copy link
Contributor

What is the purpose of the change

The PR allows to pretty print for multisets

This change added tests and can be verified as follows:

A case for multiset has been added to org.apache.flink.table.utils.PrintUtilsTest#testNestedRowToString

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, 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 Nov 12, 2021

CI report:

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

@flinkbot
Copy link
Collaborator

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 e876469 (Fri Nov 12 20:30:21 UTC 2021)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

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

@snuyanzin snuyanzin changed the title [FLINK-24889] Flink SQL Client should print corrently multisets [FLINK-24889][table] Flink SQL Client should print corrently multisets Nov 12, 2021
@snuyanzin snuyanzin changed the title [FLINK-24889][table] Flink SQL Client should print corrently multisets [FLINK-24889][table] Flink SQL Client should print correсtly multisets Nov 13, 2021
@slinkydeveloper
Copy link
Contributor

Hi, thank you for your pr.
PrintUtils doesn't exist anymore as part of the refactoring here https://issues.apache.org/jira/browse/FLINK-21456. In order to support MULTISET to STRING, now you need to add a rule like that https://github.com/apache/flink/blob/da24fbf23c244771084bf0a31cdbb9749d72e80a/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/casting/ArrayToStringCastRule.java

@snuyanzin
Copy link
Contributor Author

snuyanzin commented Nov 15, 2021

Hi @slinkydeveloper thanks for letting know about mentioned refactoring.
I've rebased branch to latest master and added a rule for multiset based on map as multiset is a map<t, Integer> as also mentioned in org.apache.flink.table.types.logical.MultisetType

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the casting logic is exactly the same, I don't think we need to have a separate rule for Multiset and Map. Just rename the map rule to MapAndMultisetToStringCastRule, change the predicate and make sure the valueType is the correct one.

… method

use is(LogicalTypeFamily.COLLECTION) to check if multiset
@snuyanzin
Copy link
Contributor Author

@slinkydeveloper thanks for your feedback.
I've made changes you've requested, could you please have a look once again.

P.S. I have no idea why Re-request review button does not work for me...

Copy link
Contributor

@slinkydeveloper slinkydeveloper left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a last minor nit comment, and then once the CI is green we can merge it. Thank you for the contribution!

@snuyanzin
Copy link
Contributor Author

thanks for the review

Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for jumping in so late. The PR looks good. I was just wondering if we would like to skip the null checking logic for values. Multiset values have always an integer. We can make the implementation a bit more efficient by skipping line 204 in MapAndMultisetToStringCastRule.

@slinkydeveloper
Copy link
Contributor

@twalthr Perhaps the point here is that valueIsNullTerm should always be false if valueType is not null, because null checks shouldn't be required?

@snuyanzin snuyanzin requested a review from twalthr November 18, 2021 13:43
Copy link
Contributor

@twalthr twalthr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update @snuyanzin. LGTM

@twalthr twalthr closed this in ad16e2c Nov 18, 2021
niklassemmler pushed a commit to niklassemmler/flink that referenced this pull request Feb 3, 2022
@snuyanzin snuyanzin deleted the flink24889 branch May 5, 2022 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants