-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Core, API: Move SQLViewRepresentation to API #9278
Conversation
@Value.Style( | ||
typeImmutable = "ImmutableSQLViewRepresentation", | ||
visibilityString = "PUBLIC", | ||
builderVisibilityString = "PUBLIC") | ||
interface BaseSQLViewRepresentation extends SQLViewRepresentation {} |
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.
Package private BaseSQLViewRepresentation
which extends the public SQLViewRepresentation. The generated Immutables class is public for preserving compatibility.
.palantir/revapi.yml
Outdated
- code: "java.method.visibilityReduced" | ||
old: "method org.apache.iceberg.view.ImmutableSQLViewRepresentation org.apache.iceberg.view.ImmutableSQLViewRepresentation::copyOf(org.apache.iceberg.view.SQLViewRepresentation)" | ||
new: "method org.apache.iceberg.view.ImmutableSQLViewRepresentation org.apache.iceberg.view.ImmutableSQLViewRepresentation::copyOf(org.apache.iceberg.view.BaseSQLViewRepresentation)" | ||
justification: "Immutables generated copyOf visibility changed" |
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 think there must have been some behavior change in Immutables between the original code generation for SQLViewRepresentation and now. Immutables now generates a package-private copyOf (confirmed with ViewVersion). However, prior to this change the generated copyOf for SQLViewRepresentation was actually public. This is technically breaking to downgrade the copyOf but I don't see any options in the Immutables
docs to control this behavior. Before merging this though, I'll explore a few options. Since the view APIs are newer we have more flexibility here
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.
unfortunately it looks like the visibility of copyOf()
is tied directly to the visibility of BaseSQLViewRepresentation
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.
You're right, it's tied to the visibility of the actual class which makes sense. Since we probably want to just go for 100% backwards compatibility I went with maintaining a copy of the Immutables generated class. I explored the option of generating a package private immutable class which we extend but Inheritance of the class isn't possible since it's final (Immutables only generates final classes as far as I can tell)
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'll try to exlore some other alternatives this week
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.
@amogh-jahagirdar I've created #9302 which doesn't break the API and also doesn't require to copy anything from the generated class
Looks like some unrelated Flink tests failed, noting here:
|
Ah I see the flink failure was fixed recently in #9216, I just need to rebase |
040fa7b
to
07630b8
Compare
import org.apache.iceberg.relocated.com.google.common.base.Preconditions; | ||
import org.apache.iceberg.relocated.com.google.common.collect.Lists; | ||
|
||
/** This is a copy of the Immutables generated class to preserve backwards compatibility */ |
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.
To keep full backwards compatibility the approach taken here is to keep a copy of the Immutables generated code which is unfortunate; but preserving backwards compatibility is probably more important. I had to edit the class to make it respect our checkstyle.
07630b8
to
26f3976
Compare
26f3976
to
30e9401
Compare
Closing in favor of #9302 |
This change is similar to the one done a while back for
BaseViewVersion
. SQLViewRepresentation is moved from the core module to the API module (since it is a concept that's apparent in the spec). This stems from this thread https://github.com/apache/iceberg/pull/9247/files#r1419759456