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

Add support for write.data.path #1611

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

Add support for write.data.path #1611

wants to merge 2 commits into from

Conversation

Fokko
Copy link
Contributor

@Fokko Fokko commented Feb 4, 2025

Relates to #1492

@Fokko Fokko added this to the PyIceberg 0.9.0 release milestone Feb 4, 2025
@Fokko Fokko requested a review from kevinjqliu February 4, 2025 19:51
Copy link
Contributor

@smaheshwar-pltr smaheshwar-pltr 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 picking this up @Fokko! Looks great, just small comments 😄

pyiceberg/table/locations.py Outdated Show resolved Hide resolved
| `write.object-storage.enabled` | Boolean | True | Enables the [`ObjectStoreLocationProvider`](configuration.md#object-store-location-provider) that adds a hash component to file paths. Note: the default value of `True` differs from Iceberg's Java implementation |
| `write.object-storage.partitioned-paths` | Boolean | True | Controls whether [partition values are included in file paths](configuration.md#partition-exclusion) when object storage is enabled |
| `write.py-location-provider.impl` | String of form `module.ClassName` | null | Optional, [custom `LocationProvider`](configuration.md#loading-a-custom-location-provider) implementation |
| `write.data.path` | String pointing to location | ∅ | Sets the location where to write the data. If not set, it will use the table location postfixed with `data/`. |
Copy link
Contributor

@smaheshwar-pltr smaheshwar-pltr Feb 5, 2025

Choose a reason for hiding this comment

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

Not sure about the best wording here - maybe something like:

Suggested change
| `write.data.path` | String pointing to location || Sets the location where to write the data. If not set, it will use the table location postfixed with `data/`. |
| `write.data.path` | String referencing a location || Sets the location under which data is written. If not set, the table location (`table.metadata.location`) postfixed with `data/` is used. |

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, what about 'table location + /data' as the default instead of ∅ like in the Java docs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Also bringing attention to #1537 (comment) - it would be great to make the location providers docs consistent with write.data.path now.

The `SimpleLocationProvider` places a table's file names underneath a `data` directory in the table's base storage

Paths still contain partitions just before the file name, in Hive-style, and a `data` directory beneath the table's location,

I think these are the only places that require changing - they'll be write.data.path (and maybe for clarity we should reiterate there that this defaults to {location}/data so examples are clearer). Could we do that in this PR maybe? (Happy to follow-up with this otherwise)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the input here, I've changed some wording en reworked some of the sections. Let me know what you think 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks great - thank you!

tests/table/test_locations.py Outdated Show resolved Hide resolved
Copy link
Contributor

@kevinjqliu kevinjqliu left a comment

Choose a reason for hiding this comment

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

LGTM! i added the reference to #1492 in the description

Paths still contain partitions just before the file name, in Hive-style, and a `data` directory beneath the table's location,
in a similar manner to the [`SimpleLocationProvider`](configuration.md#simple-location-provider). For example, a table
partitioned over a string column `category` might have a data file with location: (note the additional binary directories)
Paths still are also prefixed by `{location}/data/`, where `location` comes from the [table metadata](https://iceberg.apache.org/spec/#table-metadata-fields), in a similar manner to the [`SimpleLocationProvider`](configuration.md#simple-location-provider). This can be overridden by setting [`write.data.path` table configuration](#write-options).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Paths still are also prefixed by `{location}/data/`, where `location` comes from the [table metadata](https://iceberg.apache.org/spec/#table-metadata-fields), in a similar manner to the [`SimpleLocationProvider`](configuration.md#simple-location-provider). This can be overridden by setting [`write.data.path` table configuration](#write-options).
Paths are still prefixed by `{location}/data/`, where `location` comes from the [table metadata](https://iceberg.apache.org/spec/#table-metadata-fields), in a similar manner to the [`SimpleLocationProvider`](configuration.md#simple-location-provider). This can be overridden by setting [`write.data.path` table configuration](#write-options).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants