You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "ebyhr (via GitHub)" <gi...@apache.org> on 2026/09/29 03:24:58 UTC
[PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
ebyhr opened a new pull request, #18304:
URL: https://github.com/apache/iceberg/pull/18304
Otherwise, it causes `java.lang.NoClassDefFoundError: org/apache/hadoop/fs/Path` in Trino Iceberg connector.
- Relates to #14284
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4231804110
##########
core/src/test/java/org/apache/iceberg/TestObjectStoreLocationProvider.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+class TestObjectStoreLocationProvider {
+ @ParameterizedTest
+ @CsvSource({
+ "s3://bucket/db/table, db/table",
+ "s3://bucket/db/table/, db/table",
+ "s3://bucket/ns/db/table, db/table",
+ "s3://bucket/table, table",
+ "s3://bucket/a//table, table",
Review Comment:
Empty path segments (LocationProviders.java:208): Hadoop Path collapsed //, so s3://bucket/a//table gave the context `a/table`. The new parser gives `table`. Existing tables with that kind of location would write new data files under a different prefix than their old files.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4129607454
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,17 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
Review Comment:
would it be worth creating a Trino issue with a repro scenario to provide more transparency on the issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#issuecomment-5916007690
Thanks for working on this issue @ebyhr! Apache NiFi is also tracking this issue under [NIFI-16405](https://issues.apache.org/jira/browse/NIFI-16405), so getting Hadoop `Path` refactored out of this class would be very helpful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4151764631
##########
core/src/test/java/org/apache/iceberg/TestLocationProvider.java:
##########
@@ -263,6 +263,26 @@ public void testObjectStorageWithinTableLocation() {
assertThat(parts).element(6).asString().isEqualTo("test.parquet");
}
+ @TestTemplate
+ public void testObjectStoragePathContext() {
+ assertPathContext("s3://bucket/db/table", "db/table");
+ assertPathContext("s3://bucket/db/table/", "db/table");
+ assertPathContext("s3://bucket/ns/db/table", "db/table");
+ assertPathContext("s3://bucket/table", "/table");
Review Comment:
While this is actually the functionality that existed with `Path` , I'm not sure whether it makes sense to have it.
We may end up unintentionally building double-slashed paths this way:
https://github.com/apache/iceberg/blob/f12ec1b5c6f1c88a941b0ebd3a9064fb45264efa/core/src/main/java/org/apache/iceberg/LocationProviders.java#L149
https://github.com/apache/iceberg/blob/f12ec1b5c6f1c88a941b0ebd3a9064fb45264efa/core/src/main/java/org/apache/iceberg/LocationProviders.java#L188
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4129685996
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,17 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ String path = LocationUtil.stripTrailingSlash(tableLocation);
Review Comment:
which test can be used to verify these changes?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4151764631
##########
core/src/test/java/org/apache/iceberg/TestLocationProvider.java:
##########
@@ -263,6 +263,26 @@ public void testObjectStorageWithinTableLocation() {
assertThat(parts).element(6).asString().isEqualTo("test.parquet");
}
+ @TestTemplate
+ public void testObjectStoragePathContext() {
+ assertPathContext("s3://bucket/db/table", "db/table");
+ assertPathContext("s3://bucket/db/table/", "db/table");
+ assertPathContext("s3://bucket/ns/db/table", "db/table");
+ assertPathContext("s3://bucket/table", "/table");
Review Comment:
While this is actually the functionality that existed with `Path` , I'm not sure whether it makes sense to have it.
We may end up unintentionally building double-slashed paths this way:
https://github.com/apache/iceberg/blob/f12ec1b5c6f1c88a941b0ebd3a9064fb45264efa/core/src/main/java/org/apache/iceberg/LocationProviders.java#L188
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "findinpath (via GitHub)" <gi...@apache.org>.
findinpath commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4231807984
##########
core/src/test/java/org/apache/iceberg/TestObjectStoreLocationProvider.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+class TestObjectStoreLocationProvider {
+ @ParameterizedTest
+ @CsvSource({
+ "s3://bucket/db/table, db/table",
+ "s3://bucket/db/table/, db/table",
+ "s3://bucket/ns/db/table, db/table",
+ "s3://bucket/table, table",
+ "s3://bucket/a//table, table",
Review Comment:
Maybe it is worth documenting this
##########
core/src/test/java/org/apache/iceberg/TestObjectStoreLocationProvider.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+class TestObjectStoreLocationProvider {
+ @ParameterizedTest
+ @CsvSource({
+ "s3://bucket/db/table, db/table",
+ "s3://bucket/db/table/, db/table",
+ "s3://bucket/ns/db/table, db/table",
+ "s3://bucket/table, table",
+ "s3://bucket/a//table, table",
Review Comment:
Maybe it is worth documenting this change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "github-actions[bot] (via GitHub) via issues" <is...@iceberg.apache.org>.
github-actions[bot] commented on PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#issuecomment-6886470067
This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#issuecomment-6073323488
@rdblue @findinpath Thanks for your review! Addressed comments.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4226173247
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ // strip the scheme and authority (e.g. "s3://bucket") so only path segments remain
+ String path = tableLocation;
+ int schemeEnd = path.indexOf("://");
+ if (schemeEnd >= 0) {
+ int authorityEnd = path.indexOf('/', schemeEnd + 3);
+ path = authorityEnd < 0 ? "" : path.substring(authorityEnd);
+ }
+
+ if (path.isEmpty()) {
+ return "";
Review Comment:
Yeah, this line is meant to preserve existing behavior. I can't find a compelling reason to retain it. Updated.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4213568395
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
Review Comment:
@rdblue Could you please review this PR?
- This method was added by https://github.com/apache/iceberg/pull/87
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4144042696
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,17 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
Review Comment:
pathContext() has zero test coverage. Every OBJECT_STORE_ENABLED test in TestLocationProvider (testObjectStorageWithinTableLocation, testEncodedFieldNameInPartitionPath, testExcludePartitionInPath, testHashInjection) uses the default data location, so storageLocation.startsWith(tableLocation) holds, context is null, and the reimplemented method never executes; the two tests that set an external object-store path use deprecated properties that throw first. Green CI does not exercise the changed code at all.
Please consider adding a TestLocationProvider case with OBJECT_STORE_ENABLED=true and WRITE_DATA_LOCATION outside the table prefix, with computed (not hardcoded) expectations across scheme/authority, nested, single-segment, and trailing-slash inputs.
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,17 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ String path = LocationUtil.stripTrailingSlash(tableLocation);
+ int lastSlash = path.lastIndexOf('/');
+ String name = lastSlash < 0 ? path : path.substring(lastSlash + 1);
String resolvedContext;
- if (parent != null) {
+ if (lastSlash > 0) {
+ int parentSlash = path.lastIndexOf('/', lastSlash - 1);
// remove the data folder
- resolvedContext = String.format("%s/%s", parent.getName(), dataPath.getName());
+ String parentName = path.substring(parentSlash + 1, lastSlash);
+ resolvedContext = String.format("%s/%s", parentName, name);
} else {
Review Comment:
The reimplementation is byte-identical to the old Hadoop Path logic for every location with two or more path segments (the dominant scheme://auth/db/table case — verified db/table both ways), but silently diverges for single-path-segment locations. Traced at head: s3://bucket/table -> old /table vs new bucket/table; /table -> old /table vs new table; s3://bucket -> old "" vs new /bucket. This branch is reached only in object-store mode with a write.data.path outside the table prefix, so it changes the prefix where NEW files land for such tables (no data corruption — manifests store full paths). The change ships inside a "refactor" with no mention in the PR description. Either preserve the old output or document the change, and add the coverage above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223243307
##########
core/src/test/java/org/apache/iceberg/TestLocationProvider.java:
##########
@@ -263,6 +263,26 @@ public void testObjectStorageWithinTableLocation() {
assertThat(parts).element(6).asString().isEqualTo("test.parquet");
}
+ @TestTemplate
+ public void testObjectStoragePathContext() {
+ assertPathContext("s3://bucket/db/table", "db/table");
+ assertPathContext("s3://bucket/db/table/", "db/table");
+ assertPathContext("s3://bucket/ns/db/table", "db/table");
+ assertPathContext("s3://bucket/table", "/table");
+ assertPathContext("s3://bucket", "");
+ }
+
+ private static void assertPathContext(String tableLocation, String expectedContext) {
+ LocationProvider provider =
+ new LocationProviders.ObjectStoreLocationProvider(
+ tableLocation, Map.of(TableProperties.WRITE_DATA_LOCATION, "s3://other/data"));
Review Comment:
I don't think that this helper method is useful. It is only called from one test case so this provider can be embedded there. That would be more readable.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223278307
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ // strip the scheme and authority (e.g. "s3://bucket") so only path segments remain
+ String path = tableLocation;
+ int schemeEnd = path.indexOf("://");
+ if (schemeEnd >= 0) {
+ int authorityEnd = path.indexOf('/', schemeEnd + 3);
+ path = authorityEnd < 0 ? "" : path.substring(authorityEnd);
+ }
+
+ if (path.isEmpty()) {
+ return "";
Review Comment:
Returning an empty string is always a red flag for me. Is this preserving existing behavior? If so, we need to justify why it is necessary to preserve it (vs returning null and handling it). If it stays, we need a comment about why we *cannot* change it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223301915
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
- Path dataPath = new Path(tableLocation);
- Path parent = dataPath.getParent();
+ // strip the scheme and authority (e.g. "s3://bucket") so only path segments remain
+ String path = tableLocation;
+ int schemeEnd = path.indexOf("://");
Review Comment:
I don't think this is quite correct. The `:` is associated with the scheme. Authority begins with `//` if it is present. Authority may also be empty, as in `file:///`.
I would start by borrowing some of the logic from `LocationUtil` for detecting a scheme. Also, is it possible to start from the end of the string and work backward?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4151835336
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,17 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
Review Comment:
- https://github.com/trinodb/trino/issues/31392
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4213703907
##########
core/src/main/java/org/apache/iceberg/LocationProviders.java:
##########
@@ -198,14 +197,29 @@ public String newDataLocation(String filename) {
}
private static String pathContext(String tableLocation) {
Review Comment:
FYI, [ObjectStoreLocationProvider.pathContext](https://github.com/trinodb/trino/blob/9f962d6747ab6d6ff3ac8fde2cf4ceda9af57344/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/util/ObjectStoreLocationProvider.java#L91-L111) is the corresponding method in Trino, which is utilized by non-REST catalogs. We have been using it since 2023.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223247623
##########
core/src/test/java/org/apache/iceberg/TestLocationProvider.java:
##########
@@ -263,6 +263,26 @@ public void testObjectStorageWithinTableLocation() {
assertThat(parts).element(6).asString().isEqualTo("test.parquet");
}
+ @TestTemplate
+ public void testObjectStoragePathContext() {
+ assertPathContext("s3://bucket/db/table", "db/table");
+ assertPathContext("s3://bucket/db/table/", "db/table");
+ assertPathContext("s3://bucket/ns/db/table", "db/table");
+ assertPathContext("s3://bucket/table", "/table");
Review Comment:
Agreed. This should not produce leading or trailing `/`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "rdblue (via GitHub)" <gi...@apache.org>.
rdblue commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4223257991
##########
core/src/test/java/org/apache/iceberg/TestLocationProvider.java:
##########
@@ -263,6 +263,26 @@ public void testObjectStorageWithinTableLocation() {
assertThat(parts).element(6).asString().isEqualTo("test.parquet");
}
+ @TestTemplate
+ public void testObjectStoragePathContext() {
+ assertPathContext("s3://bucket/db/table", "db/table");
Review Comment:
Could you add a `file:/` case and a `file:///` case?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Avoid Hadoop Path in LocationProviders [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #18304:
URL: https://github.com/apache/iceberg/pull/18304#discussion_r4226187913
##########
core/src/test/java/org/apache/iceberg/TestObjectStoreLocationProvider.java:
##########
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Map;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.CsvSource;
+import org.junit.jupiter.params.provider.ValueSource;
+
+class TestObjectStoreLocationProvider {
+ @ParameterizedTest
+ @CsvSource({
Review Comment:
I've created a new test class because the parameterized annotation conflicts with the class-level annotation of `TestLocationProvider`. Let me know if we'd prefer to add loop-based tests to `TestLocationProvider` instead.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org