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
44 changes: 40 additions & 4 deletions docs/src/main/sphinx/connector/iceberg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ To use Iceberg, you need:
Configuration
-------------

The connector supports two Iceberg catalog types, you may use either a Hive
metastore service (HMS) or AWS Glue. The catalog type is determined by the
``iceberg.catalog.type`` property, it can be set to either ``HIVE_METASTORE``
or ``GLUE``.
The connector supports multiple Iceberg catalog types, you may use either a Hive
metastore service (HMS), AWS Glue, or a REST catalog. The catalog type is determined by the
``iceberg.catalog.type`` property, it can be set to ``HIVE_METASTORE``, ``GLUE``, or ``REST``.


.. _iceberg-hive-catalog:
Expand Down Expand Up @@ -81,6 +80,43 @@ configuration properties as the Hive connector's Glue setup. See
connector.name=iceberg
iceberg.catalog.type=glue

REST catalog
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@mosabua please review the docs

^^^^^^^^^^^^^^

In order to use the Iceberg REST catalog, ensure to configure the catalog type with
``iceberg.catalog.type=rest`` and provide further details with the following
properties:

============================================== ============================================================
Property Name Description
============================================== ============================================================
``iceberg.rest-catalog.uri`` REST server API endpoint URI (required).
Example: ``http://iceberg-with-rest:8181``

``iceberg.rest-catalog.security`` The type of security to use (default: ``NONE``). ``OAUTH2``
requires either a ``token`` or ``credential``.
Example: ``OAUTH2``

``iceberg.rest-catalog.session`` Session information included when communicating with the REST Catalog.
Options are ``NONE`` or ``USER`` (default: ``NONE``).

``iceberg.rest-catalog.oauth2.token`` The Bearer token which will be used for interactions
with the server. A ``token`` or ``credential`` is required for
``OAUTH2`` security.
Example: ``AbCdEf123456``

``iceberg.rest-catalog.oauth2.credential`` The credential to exchange for a token in the OAuth2 client
credentials flow with the server. A ``token`` or ``credential``
is required for ``OAUTH2`` security.
Example: ``AbCdEf123456``
============================================== ============================================================

.. code-block:: text

connector.name=iceberg
iceberg.catalog.type=rest
iceberg.rest-catalog.uri=http://iceberg-with-rest:8181


General configuration
^^^^^^^^^^^^^^^^^^^^^
Expand Down
72 changes: 72 additions & 0 deletions plugin/trino-iceberg/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
<groupId>com.linkedin.calcite</groupId>
<artifactId>calcite-core</artifactId>
</exclusion>
<exclusion>
<groupId>io.airlift</groupId>
<artifactId>http-client</artifactId>
</exclusion>
</exclusions>
</dependency>

Expand Down Expand Up @@ -145,6 +149,21 @@
<artifactId>guice</artifactId>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
</dependency>

<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
</dependency>

<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
Expand Down Expand Up @@ -238,6 +257,27 @@
<scope>runtime</scope>
</dependency>

<dependency>
Comment thread
danielcweeks marked this conversation as resolved.
Outdated
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.1</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
<artifactId>httpcore5</artifactId>
<version>5.1.1</version>
<scope>runtime</scope>
</dependency>

<dependency>
Comment thread
danielcweeks marked this conversation as resolved.
Outdated
<groupId>org.apache.iceberg</groupId>
<artifactId>iceberg-bundled-guava</artifactId>
<version>${dep.iceberg.version}</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.apache.iceberg</groupId>
<artifactId>iceberg-orc</artifactId>
Expand Down Expand Up @@ -345,6 +385,18 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>http-server</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>node</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>io.airlift</groupId>
<artifactId>testing</artifactId>
Expand All @@ -367,6 +419,19 @@
</exclusions>
</dependency>

<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.apache.iceberg</groupId>
<artifactId>iceberg-core</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
Expand All @@ -378,6 +443,13 @@
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.36.0.3</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ public enum CatalogType
TESTING_FILE_METASTORE,
HIVE_METASTORE,
GLUE,
REST,
/**/;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
import io.trino.plugin.iceberg.catalog.file.IcebergFileMetastoreCatalogModule;
import io.trino.plugin.iceberg.catalog.glue.IcebergGlueCatalogModule;
import io.trino.plugin.iceberg.catalog.hms.IcebergHiveMetastoreCatalogModule;
import io.trino.plugin.iceberg.catalog.rest.IcebergRestCatalogModule;

import static io.airlift.configuration.ConditionalModule.conditionalModule;
import static io.trino.plugin.iceberg.CatalogType.GLUE;
import static io.trino.plugin.iceberg.CatalogType.HIVE_METASTORE;
import static io.trino.plugin.iceberg.CatalogType.REST;
import static io.trino.plugin.iceberg.CatalogType.TESTING_FILE_METASTORE;

public class IcebergCatalogModule
Expand All @@ -36,6 +38,7 @@ protected void setup(Binder binder)
bindCatalogModule(HIVE_METASTORE, new IcebergHiveMetastoreCatalogModule());
bindCatalogModule(TESTING_FILE_METASTORE, new IcebergFileMetastoreCatalogModule());
bindCatalogModule(GLUE, new IcebergGlueCatalogModule());
bindCatalogModule(REST, new IcebergRestCatalogModule());
}

private void bindCatalogModule(CatalogType catalogType, Module module)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
/*
* Licensed 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 io.trino.plugin.iceberg.catalog.rest;

import io.airlift.configuration.Config;
import io.airlift.configuration.ConfigDescription;

import javax.validation.constraints.NotNull;

import java.net.URI;

public class IcebergRestCatalogConfig
{
public enum Security
{
NONE,
OAUTH2,
}

public enum SessionType
{
NONE,
USER
}

private URI restUri;
private Security security = Security.NONE;
private SessionType sessionType = SessionType.NONE;

@NotNull
public URI getBaseUri()
{
return this.restUri;
}

@Config("iceberg.rest-catalog.uri")
@ConfigDescription("The URI to the REST server")
public IcebergRestCatalogConfig setBaseUri(String uri)
{
if (uri != null) {
Comment thread
danielcweeks marked this conversation as resolved.
Outdated
this.restUri = URI.create(uri);
}
return this;
}

@NotNull
public Security getSecurity()
{
return security;
}

@Config("iceberg.rest-catalog.security")
@ConfigDescription("Authorization protocol to use when communicating with the REST catalog server")
Comment thread
danielcweeks marked this conversation as resolved.
Outdated
public IcebergRestCatalogConfig setSecurity(Security security)
{
this.security = security;
return this;
}

@NotNull
public IcebergRestCatalogConfig.SessionType getSessionType()
{
return sessionType;
}

@Config("iceberg.rest-catalog.session")
@ConfigDescription("Type of REST catalog sessionType to use when communicating with REST catalog Server")
public IcebergRestCatalogConfig setSessionType(SessionType sessionType)
{
this.sessionType = sessionType;
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed 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 io.trino.plugin.iceberg.catalog.rest;

import com.google.inject.Binder;
import com.google.inject.Scopes;
import io.airlift.configuration.AbstractConfigurationAwareModule;
import io.trino.plugin.iceberg.catalog.TrinoCatalogFactory;
import io.trino.plugin.iceberg.catalog.rest.IcebergRestCatalogConfig.Security;

import static io.airlift.configuration.ConditionalModule.conditionalModule;
import static io.airlift.configuration.ConfigBinder.configBinder;

public class IcebergRestCatalogModule
extends AbstractConfigurationAwareModule
{
@Override
protected void setup(Binder binder)
{
configBinder(binder).bindConfig(IcebergRestCatalogConfig.class);
install(conditionalModule(
IcebergRestCatalogConfig.class,
config -> config.getSecurity() == Security.OAUTH2,
new OAuth2SecurityModule(),
new NoneSecurityModule()));

binder.bind(TrinoCatalogFactory.class).to(TrinoIcebergRestCatalogFactory.class).in(Scopes.SINGLETON);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Licensed 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 io.trino.plugin.iceberg.catalog.rest;

import com.google.inject.Binder;
import io.airlift.configuration.AbstractConfigurationAwareModule;

public class NoneSecurityModule
extends AbstractConfigurationAwareModule
{
@Override
protected void setup(Binder binder)
{
binder.bind(SecurityProperties.class).to(NoneSecurityProperties.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed 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 io.trino.plugin.iceberg.catalog.rest;

import com.google.common.collect.ImmutableMap;

import java.util.Map;

public class NoneSecurityProperties
implements SecurityProperties
{
@Override
public Map<String, String> get()
{
return ImmutableMap.of();
}
}
Loading