Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dep.testng.version>7.5</dep.testng.version>
<dep.lucene.version>9.12.0</dep.lucene.version>
<dep.assertj-core.version>3.8.0</dep.assertj-core.version>
<dep.parquet.version>1.13.1</dep.parquet.version>
<dep.parquet.version>1.16.0</dep.parquet.version>
<dep.asm.version>9.7.1</dep.asm.version>
<dep.gcs.version>1.9.17</dep.gcs.version>
<dep.alluxio.version>313</dep.alluxio.version>
Expand All @@ -79,7 +79,7 @@
<dep.guava.version>32.1.0-jre</dep.guava.version>
<dep.jackson.version>2.15.4</dep.jackson.version>
<dep.j2objc.version>3.0.0</dep.j2objc.version>
<dep.avro.version>1.11.4</dep.avro.version>
<dep.avro.version>1.12.0</dep.avro.version>
<dep.commons.compress.version>1.27.1</dep.commons.compress.version>
<dep.protobuf-java.version>4.29.0</dep.protobuf-java.version>
<dep.jetty.version>12.0.29</dep.jetty.version>
Expand Down
24 changes: 23 additions & 1 deletion presto-iceberg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<properties>
<air.main.basedir>${project.parent.basedir}</air.main.basedir>
<project.build.targetJdk>17</project.build.targetJdk>
<dep.iceberg.version>1.8.1</dep.iceberg.version>
<dep.iceberg.version>1.10.0</dep.iceberg.version>
<dep.nessie.version>0.103.0</dep.nessie.version>
<air.check.skip-modernizer>true</air.check.skip-modernizer>
</properties>
Expand Down Expand Up @@ -88,6 +88,22 @@
</exclusions>
</dependency>

<dependency>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-hadoop</artifactId>
<version>${dep.parquet.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.yetus</groupId>
<artifactId>audience-annotations</artifactId>
</exclusion>
Comment thread
Joe-Abraham marked this conversation as resolved.
<exclusion>
<groupId>org.apache.hadoop</groupId>
<artifactId>hadoop-client</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>com.facebook.presto</groupId>
<artifactId>presto-expressions</artifactId>
Expand Down Expand Up @@ -390,6 +406,12 @@
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>kms</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.apache.iceberg</groupId>
<artifactId>iceberg-parquet</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4175,7 +4175,7 @@ private void writePositionDeleteToNationTable(Table icebergTable, String dataFil
FileSystem fs = getHdfsEnvironment().getFileSystem(new HdfsContext(SESSION), metadataDir);
Path path = new Path(metadataDir, deleteFileName);
PositionDeleteWriter<Record> writer = Parquet.writeDeletes(HadoopOutputFile.fromPath(path, fs))
.createWriterFunc(GenericParquetWriter::buildWriter)
.createWriterFunc(GenericParquetWriter::create)
.forTable(icebergTable)
.overwrite()
.rowSchema(icebergTable.schema())
Expand Down Expand Up @@ -4209,7 +4209,7 @@ private void writeEqualityDeleteToNationTable(Table icebergTable, Map<String, Ob
Parquet.DeleteWriteBuilder writerBuilder = Parquet.writeDeletes(HadoopOutputFile.fromPath(new Path(metadataDir, deleteFileName), fs))
.forTable(icebergTable)
.rowSchema(deleteRowSchema)
.createWriterFunc(GenericParquetWriter::buildWriter)
.createWriterFunc(GenericParquetWriter::create)
.equalityFieldIds(deleteRowSchema.columns().stream().map(Types.NestedField::fieldId).collect(Collectors.toList()))
.overwrite();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ protected QueryRunner createQueryRunner()
Map<String, String> connectorProperties = ImmutableMap.<String, String>builder()
.putAll(restConnectorProperties(serverUri))
.put("iceberg.rest.session.type", SessionType.USER.name())
// Enable OAuth2 authentication to trigger token exchange flow
// The credential is required to initialize the OAuth2Manager
.put("iceberg.rest.auth.type", "OAUTH2")
.put("iceberg.rest.auth.oauth2.credential", "client:secret")
.build();

return IcebergQueryRunner.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.iceberg.rest.HTTPRequest.HTTPMethod;
import org.apache.iceberg.rest.RESTCatalogAdapter.Route;
import org.apache.iceberg.rest.responses.ErrorResponse;
import org.apache.iceberg.rest.responses.OAuthTokenResponse;
import org.apache.iceberg.util.Pair;

import java.io.IOException;
Expand All @@ -53,6 +54,11 @@ public class IcebergRestCatalogServlet
{
private static final Logger LOG = Logger.get(IcebergRestCatalogServlet.class);

private static final String SUBJECT_TOKEN = "subject_token";
private static final String GRANT_TYPE = "grant_type";
private static final String TOKEN_EXCHANGE_GRANT_TYPE = "urn:ietf:params:oauth:grant-type:token-exchange";
private static final String TOKEN_EXCHANGE_PREFIX = "token-exchange-token:sub=";

private final RESTCatalogAdapter restCatalogAdapter;
private final Map<String, String> responseHeaders =
ImmutableMap.of(HttpHeaders.CONTENT_TYPE, ContentType.APPLICATION_JSON.getMimeType());
Expand Down Expand Up @@ -105,11 +111,32 @@ protected void execute(ServletRequestContext context, HttpServletResponse respon
}

if (context.error().isPresent()) {
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
RESTObjectMapper.mapper().writeValue(response.getWriter(), context.error().get());
ErrorResponse error = context.error().get();
response.setStatus(error.code());
RESTObjectMapper.mapper().writeValue(response.getWriter(), error);
return;
}

// Handle token exchange requests specially to preserve user identity
if (context.route() == Route.TOKENS && context.body() instanceof Map) {
@SuppressWarnings("unchecked")
Map<String, String> tokenRequest = (Map<String, String>) context.body();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this casting safe?

String grantType = tokenRequest.get(GRANT_TYPE);
String subjectToken = tokenRequest.get(SUBJECT_TOKEN);

if (TOKEN_EXCHANGE_GRANT_TYPE.equals(grantType) && subjectToken != null) {
// Return the subject token prefixed so that authorization check can extract the original JWT
String responseToken = TOKEN_EXCHANGE_PREFIX + subjectToken;
OAuthTokenResponse oauthResponse = OAuthTokenResponse.builder()
.withToken(responseToken)
.withTokenType("Bearer")
.withIssuedTokenType("urn:ietf:params:oauth:token-type:access_token")
.build();
RESTObjectMapper.mapper().writeValue(response.getWriter(), oauthResponse);
return;
}
}

try {
HTTPRequest request = restCatalogAdapter.buildRequest(
context.method(),
Expand Down
24 changes: 0 additions & 24 deletions presto-native-execution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,6 @@
<groupId>org.apache.hudi</groupId>
<artifactId>hudi-presto-bundle</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format-structures</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
Expand All @@ -223,18 +211,6 @@
<groupId>com.esotericsoftware</groupId>
<artifactId>kryo-shaded</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-column</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.parquet</groupId>
<artifactId>parquet-format-structures</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down
Loading