Repository navigation
feat(plugin-iceberg): Write native Iceberg data to the location provider's directory (#28803) - #28803
apurva-meta wants to merge 1 commit into
Conversation
|
Failed to query author email: Error 1045 (28000): Access denied for user 'presto'@'10.167.107.7' (using password: YES) |
Reviewer's GuideData structuresAdd
APIExtend the Java/C++ Iceberg handle protocol with the nullable layout field and serialize it compatibly across coordinator and worker versions.
Uses of the APIResolve and pass the write location through each coordinator write path, including create, insert, merge, delete, update, refresh, and file rewrite.
ImplementationDefine the coordinator write-location value and the provider-directory resolution used to select the output directory and flat-versus-partitioned layout.
Translate the handle layout into Velox location handles so explicit flat writes use the supplied directory while legacy writes retain
TestsCover write-location selection, handle compatibility, protocol round-tripping, and native flat-versus-legacy path translation.
Other changesFiles not grouped.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 3 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java" line_range="787-789" />
<code_context>
return finishInsert(session, (IcebergOutputTableHandle) tableHandle, fragments);
}
+ protected IcebergWriteLocation getWriteLocation(ConnectorSession session, Table icebergTable)
+ {
+ return IcebergWriteLocation.forTable(icebergTable);
+ }
+
</code_context>
<issue_to_address>
**Provider writes use stale directories**
When a table uses a per-commit registration location provider, `getWriteLocation` returns `forTable` in the inherited default, so production write paths pass `table.location()` and partition paths to workers instead of selecting the provider location; files land outside the directory registered for the commit.
Resolve the provider-selected `IcebergWriteLocation` in the production metadata hook and route writes through it.
Also at `presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java:285`.
</issue_to_address>
### Comment 2
<location path="presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java" line_range="285" />
<code_context>
.add(new SortField(Z_ORDER.getId(), com.facebook.presto.common.block.SortOrder.ASC_NULLS_LAST))
.build();
}
+ IcebergWriteLocation writeLocation = IcebergWriteLocation.forTable(icebergTable);
return new IcebergDistributedProcedureHandle(
tableHandle.getSchemaName(),
</code_context>
<issue_to_address>
**Rewrites use stale directories**
When `rewrite_data_files` runs for a table whose provider selects a per-commit directory, `RewriteDataFilesProcedure` calls `forTable` directly, so rewrite workers receive `table.location()` and the legacy partition layout instead of the provider-selected directory; rewritten files land outside the directory registered for the commit.
Resolve the provider-selected write location for rewrite tasks instead of calling `forTable` directly.
</issue_to_address>
### Comment 3
<location path="presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java" line_range="2861" />
<code_context>
validateGeospatialWrite(icebergTable);
// Return value (file schema) is intentionally ignored here; IcebergFileWriterFactory recomputes it per writer.
UnknownUtils.validateWritable(icebergTable.schema());
+ IcebergWriteLocation writeLocation = getWriteLocation(session, icebergTable);
return new IcebergInsertTableHandle(
table.getSchemaName(),
</code_context>
<issue_to_address>
**Updates change legacy write layout**
When a copy-on-write UPDATE runs for a table whose write-location hook selects a per-commit directory, `finishUpdate` resolves `getWriteLocation` and propagates its location and partition-path flag in the output handle, so copy-on-write UPDATEs use the provider-selected directory and layout instead of the legacy table location and partition paths, contrary to the stated scope.
Keep copy-on-write UPDATEs on the legacy table location and partition paths, and avoid resolving a per-commit location after workers have written their fragments.
</issue_to_address>| .add(new SortField(Z_ORDER.getId(), com.facebook.presto.common.block.SortOrder.ASC_NULLS_LAST)) | ||
| .build(); | ||
| } | ||
| IcebergWriteLocation writeLocation = IcebergWriteLocation.forTable(icebergTable); |
There was a problem hiding this comment.
🟠 High · Rewrites use stale directories
When rewrite_data_files runs for a table whose provider selects a per-commit directory, RewriteDataFilesProcedure calls forTable directly, so rewrite workers receive table.location() and the legacy partition layout instead of the provider-selected directory; rewritten files land outside the directory registered for the commit.
Resolve the provider-selected write location for rewrite tasks instead of calling forTable directly.
Prompt for AI agents
In `presto-iceberg/src/main/java/com/facebook/presto/iceberg/procedure/RewriteDataFilesProcedure.java` at line 285:
**Rewrites use stale directories**
When `rewrite_data_files` runs for a table whose provider selects a per-commit directory, `RewriteDataFilesProcedure` calls `forTable` directly, so rewrite workers receive `table.location()` and the legacy partition layout instead of the provider-selected directory; rewritten files land outside the directory registered for the commit.
Resolve the provider-selected write location for rewrite tasks instead of calling `forTable` directly.…s directory (prestodb#28803) Summary: Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles and copy-on-write UPDATE are unchanged. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. Differential Revision: D126539789
9fdfb76 to
11664a8
Compare
11664a8 to
27ddfbc
Compare
27ddfbc to
d26c116
Compare
…der's directory (prestodb#28803) Summary: Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles and copy-on-write UPDATE are unchanged. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Differential Revision: D126539789
d26c116 to
252a161
Compare
e728558 to
9d6d67e
Compare
…der's directory (prestodb#28803) Summary: Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Differential Revision: D126539789
9d6d67e to
51dea20
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Differential Revision: D126539789
51dea20 to
1bdf8b9
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Reviewed By: sam0x1C Differential Revision: D126539789
1bdf8b9 to
169560b
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Reviewed By: sam0x1C Differential Revision: D126539789
169560b to
5b59493
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Reviewed By: sam0x1C Differential Revision: D126539789
5b59493 to
2eec994
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Reviewed By: sam0x1C Differential Revision: D126539789
2eec994 to
6bdabb5
Compare
…der's directory (prestodb#28803) Summary: X-link: https://github.com/facebookexternal/presto-facebook/pull/3694 Native workers write Iceberg data files to `<outputPath>/data/<partition>/<file>`, where `outputPath` is `table.location()`. The location provider never chooses the directory, so `write.data.path` is ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, while `table.location()` still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from `<directory>/<index>/<file>`, so the partition subdirectories break them as well. This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select. Every writable handle carries two fields: - `outputPath`: the directory for new data and delete files, resolved on the coordinator from the location provider. - `includePartitionPaths` (new, optional): `false` means `outputPath` is the directory every file goes into, with no partition subdirectories. Absent or `true` keeps today's meaning: `outputPath` is the table location, and files go under `<outputPath>/data/<partition>/`. Neither field is a table property. The coordinator resolves them through `IcebergWriteLocation`, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh and `rewrite_data_files`. Read handles are unchanged, and so is the handle `finishUpdate` builds at commit time: it keeps `table.location()` and the partition layout, and does not resolve a location after the workers have written. | Table's provider | What the coordinator sends | |---|---| | Registration (unified catalog) | the commit's registered directory, `includePartitionPaths=false` | | Anything else | unchanged: `table.location()`, table properties, `includePartitionPaths=true` | Only tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today. The registration row is supplied by the catalog adapter in the next diff (`PrestoHmsIcebergCatalog.prepareWriteLocation`). When `includePartitionPaths` is `false`, the native adapter uses `outputPath` as-is and writes flat (D126539787). Otherwise it keeps appending `/data` with partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullable `std::shared_ptr<bool>`, like `fullRefreshRequired`: the generated header, the `special/*.inc` sources, the `presto_protocol_iceberg.yml` overrides, and `Boolean` mapped to `bool` in `java-to-struct-json.py`. Rollout: backward compatible, so coordinators and workers can roll out in either order. - Old coordinator, new workers: the field is absent, so Java and native workers keep the legacy layout. - New coordinator, old workers: for every table except unified-catalog ones, the handle carries the same `outputPath` as today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes. - OSS presto-iceberg behaviour does not change: the public connector always sends the table location with `includePartitionPaths=true`, the meaning it had before. ``` == NO RELEASE NOTE == ``` Reviewed By: sam0x1C Differential Revision: D126539789
6bdabb5 to
c9d6bcb
Compare
Summary:
X-link: https://github.com/facebookexternal/presto-facebook/pull/3694
Native workers write Iceberg data files to
<outputPath>/data/<partition>/<file>, whereoutputPathistable.location(). The location provider never chooses the directory, sowrite.data.pathis ignored. For tables in the unified Iceberg catalog the result is wrong. That catalog's RegistrationLocationProvider registers a new Warm Storage directory for every commit, whiletable.location()still points at the previous commit's directory. Files land in a sealed directory the new commit does not own. Replication and read routing parse the replication index from<directory>/<index>/<file>, so the partition subdirectories break them as well.This implements the contract from sam28's design doc ("Handoff: native Presto Iceberg writes use the location provider", §3), reusing his D123720654, D123720657, D125787241, D125787243 and D125787244. The rule: the location provider selects the directory, and the writer adds no directory the provider did not select.
Every writable handle carries two fields:
outputPath: the directory for new data and delete files, resolved on the coordinator from the location provider.includePartitionPaths(new, optional):falsemeansoutputPathis the directory every file goes into, with no partition subdirectories. Absent ortruekeeps today's meaning:outputPathis the table location, and files go under<outputPath>/data/<partition>/. Neither field is a table property.The coordinator resolves them through
IcebergWriteLocation, the same way for INSERT, CTAS, DELETE, MERGE, materialized-view refresh andrewrite_data_files. Read handles are unchanged, and so is the handlefinishUpdatebuilds at commit time: it keepstable.location()and the partition layout, and does not resolve a location after the workers have written.includePartitionPaths=falsetable.location(), table properties,includePartitionPaths=trueOnly tables whose catalog vends a per-commit directory change behaviour. Every other table, Java or native, writes exactly where it does today.
The registration row is supplied by the catalog adapter in the next diff (
PrestoHmsIcebergCatalog.prepareWriteLocation).When
includePartitionPathsisfalse, the native adapter usesoutputPathas-is and writes flat (D126539787). Otherwise it keeps appending/datawith partition subdirectories, as today. Partition values stay in the commit metadata. The protocol structs gain the field as nullablestd::shared_ptr<bool>, likefullRefreshRequired: the generated header, thespecial/*.incsources, thepresto_protocol_iceberg.ymloverrides, andBooleanmapped toboolinjava-to-struct-json.py.Rollout: backward compatible, so coordinators and workers can roll out in either order.
outputPathas today, and old workers ignore the extra field. Unified-catalog tables only get a correct directory once their workers are new. Until then they behave as today, already wrong for those tables, which is what this diff fixes.includePartitionPaths=true, the meaning it had before.Reviewed By: sam0x1C
Differential Revision: D126539789