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

Throw on {write.folder-storage.path,write.object-storage.path} properties #12315

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented Feb 18, 2025

Another way of warning non-Java users about the deprecated properties

  • write.folder-storage.path
  • write.object-storage.path

This will only warn when write.data.path is not set. So hopefully the number of occurrences in the logs will be limited.

…rties

Another way of warning non-Java users about the deprecated properties

- `write.folder-storage.path`
- `write.object-storage.path`

This will only warn when `write.data.path` is not set. So hopefuly
the number in the logs will be limited.
@Fokko Fokko force-pushed the fd-warn-on-deprecations branch from 65ec291 to 6b8db34 Compare February 19, 2025 13:10
@Fokko Fokko force-pushed the fd-warn-on-deprecations branch from 6b8db34 to 216a04a Compare February 19, 2025 13:37
Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

I wonder whether the now "illegal" properties should also be caught when setting namespace/table/view properties, so that it becomes impossible to set those properties (and run into hard failures when accessing data).

There seem to be more usages of OBJECT_STORE_PATH and WRITE_FOLDER_STORAGE_LOCATION - e.g. IcebergToGlueConverter and RewriteTablePathUtil

Comment on lines 92 to 96
throw new UnsupportedOperationException(
String.format(
"Property '%s' has been deprecated and will be removed in 2.0, use '%s' instead.",
TableProperties.WRITE_FOLDER_STORAGE_LOCATION,
TableProperties.WRITE_DATA_LOCATION));
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of scattering these exceptions around the code, could we add a new DEPRECATED_PROPERTIES set like the currently existing RESERVED_PROPERTIES?

We could throw an exception if the property from this list is written, or read.
This way we can establish a single place where the properties are deprecated.

Copy link
Member

Choose a reason for hiding this comment

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

+1

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've refactored the code to use the DEPRECATED_PROPERTIES.

My opinion is that we should not fail too fast, because that's annoying to the user. For example, here when you have write.data.path and any deprecated property, it will not fail because write.data.path takes priority. Also, other properties, such as write.manifest-lists.enabled are harmless to have them, since it is now enabled by default. Fail on reading or writing any deprecated property is a bigger discussion, and should happen on the spec level because this is bigger than just the Java implementation, and would like to decouple that from this PR.

@Fokko Fokko changed the title Warn on {write.folder-storage.path,write.object-storage.path} properties Throw on {write.folder-storage.path,write.object-storage.path} properties Feb 19, 2025
@Fokko
Copy link
Contributor Author

Fokko commented Feb 19, 2025

There seem to be more usages of OBJECT_STORE_PATH and WRITE_FOLDER_STORAGE_LOCATION - e.g. IcebergToGlueConverter and RewriteTablePathUtil

I think we can just remove them with 2.0, where they are used it is harmless (removing them when you copy a table, rewriting them when you write the base location, etc).

@Fokko Fokko force-pushed the fd-warn-on-deprecations branch from ba0871f to 2ae5fca Compare February 19, 2025 16:11
ImmutableSet.of(
TableProperties.OBJECT_STORE_PATH, TableProperties.WRITE_FOLDER_STORAGE_LOCATION);

private static String getProperty(Map<String, String> properties, String key) {
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe checkDeprecation?

Copy link
Contributor

Choose a reason for hiding this comment

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

checkDeprecation is also not accurate. This method actually does both: get property value and check deprecations.

the implementation/error msg is tied to TableProperties.WRITE_DATA_LOCATION. Maybe call this getLegacyDataLocation or sth like that.

The other approach is to define DEPRECATED_PROPERTIES in TableProperties class as a map (key = deprecated property, value = new property). maybe we can get to it when the need comes. right now, we can keep the change local to LocationProviders class

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Went for getAndCheckLegacyLocation since it also applies to metadata. And yes, everything is private, so we can always move to the TableProperties.

@snazy
Copy link
Member

snazy commented Feb 19, 2025

I wonder whether the now "illegal" properties should also be caught when setting namespace/table/view properties, so that it becomes impossible to set those properties (and run into hard failures when accessing data).

I think that would quite useful to prevent users from putting in any of the "illegal" properties. WDYT?

@Fokko
Copy link
Contributor Author

Fokko commented Feb 19, 2025

I think that would quite useful to prevent users from putting in any of the "illegal" properties. WDYT?

I'm not a fan of it, because I think it is very hard to enforce across implementations. For example, we don't support the ones that were deprecated in this PR in PyIceberg/Rust/Go, let other vendors. Since we need to maintain this list, we're also not able to completely remove them at some point.

@Fokko Fokko force-pushed the fd-warn-on-deprecations branch from 16fa9b6 to bdd63f5 Compare February 19, 2025 19:19
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