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

Remove SyntheticColumnHandleBuilder #19134

Merged
merged 1 commit into from
Sep 25, 2023
Merged

Conversation

kokosing
Copy link
Member

Remove SyntheticColumnHandleBuilder

This entity was not adding much value, it had only single and simple
implementation. However it introduced complexity:

  • changed many constructors APIs
  • protected field DefaultJdbcMetadataFactory
  • allowed to introduce an override of SyntheticColumnHandleBuilder
    which on it is own is is way more complex that single package
    private method

@cla-bot cla-bot bot added the cla-signed label Sep 23, 2023
@kokosing kokosing force-pushed the origin/master/002_synthentic_hell branch from ce22aec to efa4d55 Compare September 23, 2023 21:47
This entity was not adding much value, it had only single and simple
implementation. However it introduced complexity:
 - changed many constructors APIs
 - protected field DefaultJdbcMetadataFactory
 - allowed to introduce an override of SyntheticColumnHandleBuilder
   which on it is own is is way more complex that single package
   private method
@kokosing kokosing force-pushed the origin/master/002_synthentic_hell branch from efa4d55 to 5a6c9c6 Compare September 23, 2023 21:55
Copy link
Member

@hashhar hashhar left a comment

Choose a reason for hiding this comment

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

LGTM

Some of it matches #18984, I'll rebase that after this is merged.

assertThat(createSyntheticColumn(column("column_with_over_twenty_characters"), 100).getColumnName())
.isEqualTo("column_with_over_twenty_ch_100");
assertThat(createSyntheticColumn(column("column_with_over_twenty_characters"), Integer.MAX_VALUE).getColumnName())
.isEqualTo("column_with_over_tw_2147483647");
Copy link
Member

Choose a reason for hiding this comment

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

minor: are we using soft assertions to understand which test cases actually fail? (as we replaced separate test with a single one)

Copy link
Member Author

Choose a reason for hiding this comment

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

What is soft assertion?

Copy link
Member

Choose a reason for hiding this comment

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

https://joel-costigliola.github.io/assertj/core/api/org/assertj/core/api/SoftAssertions.html

They don't fail on the first failure in the test, but try to go through all assertions in the test and only then show a report of what failed.

There's a TestNG equivalent, but I'm not an expert on TestNG ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for reference. I think regular assertions are fine. We don't use soft assertions anywhere so far, and I think there is no reason to surprise people here by doing something different than elsewhere.

I also removed using DataProvider. Copying code in tests could be sometimes better over DRY, because code is more readable. Here to be super tester, we could extract each assertion to separate test method, because they are independent. However that would be overkill too due boilerplate code (DataProvider potentially would better in that case?). Putting assertion in single method is kind of middle group. We do that in Trino where we put related assertion to a single method.

TL;DR; it is all about the taste and habits

@kokosing kokosing merged commit 5d42b7e into master Sep 25, 2023
@kokosing kokosing deleted the origin/master/002_synthentic_hell branch September 25, 2023 10:14
@github-actions github-actions bot added this to the 427 milestone Sep 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants