swift-hive-metastore

Client API to access a Hive metastore

Лицензия

Лицензия

Группа

Группа

com.facebook
Идентификатор

Идентификатор

swift-hive-metastore
Последняя версия

Последняя версия

2.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

swift-hive-metastore
Client API to access a Hive metastore
Ссылка на сайт

Ссылка на сайт

https://github.com/facebook/swift-hive-metastore
Организация-разработчик

Организация-разработчик

Facebook, Inc.
Система контроля версий

Система контроля версий

https://github.com/facebook/swift-hive-metastore

Скачать swift-hive-metastore

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.facebook/swift-hive-metastore/ -->
<dependency>
    <groupId>com.facebook</groupId>
    <artifactId>swift-hive-metastore</artifactId>
    <version>2.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.facebook/swift-hive-metastore/
implementation 'com.facebook:swift-hive-metastore:2.0'
// https://jarcasting.com/artifacts/com.facebook/swift-hive-metastore/
implementation ("com.facebook:swift-hive-metastore:2.0")
'com.facebook:swift-hive-metastore:jar:2.0'
<dependency org="com.facebook" name="swift-hive-metastore" rev="2.0">
  <artifact name="swift-hive-metastore" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.facebook', module='swift-hive-metastore', version='2.0')
)
libraryDependencies += "com.facebook" % "swift-hive-metastore" % "2.0"
[com.facebook/swift-hive-metastore "2.0"]

Зависимости

compile (16)

Идентификатор библиотеки Тип Версия
io.airlift : configuration jar 0.83
io.airlift : log jar 0.83
io.airlift : units jar 0.83
javax.validation : validation-api jar 1.1.0.Final
com.google.guava : guava jar 15.0
org.apache.thrift : libthrift jar 0.9.1
com.facebook.nifty : nifty-client jar 0.10.0
com.google.inject : guice jar 3.0
com.google.inject.extensions : guice-throwingproviders jar 3.0
com.facebook.swift : swift-annotations jar 0.10.0
com.facebook.swift : swift-codec jar 0.10.0
com.facebook.swift : swift-service jar 0.10.0
com.google.code.findbugs : annotations jar 2.0.2
org.apache.hive : hive-serde Необязательный jar 0.11.0
org.apache.hive : hive-common Необязательный jar 0.11.0
org.apache.hive : hive-shims Необязательный jar 0.11.0

provided (1)

Идентификатор библиотеки Тип Версия
org.apache.hadoop : hadoop-core Необязательный jar 0.20.2

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.11
org.testng : testng jar 6.8.7
io.airlift : testing jar 0.83
io.airlift : log-manager jar 0.83
io.airlift : bootstrap jar 0.83

Модули Проекта

Данный проект не имеет модулей.

swift-hive-metastore

A swift based client for the Hive Metastore. Swift is an annotation based implementation for the Thrift protocol, available from https://github.com/facebook/swift.

Goal of this project is to replace

<dependency>
    <groupId>org.apache.hive</groupId>
    <artifactId>hive-metastore</artifactId>
</dependency>

as a client library for users of the Hive metastore.

Only supports Thrift based metastores, there is no support for a local metastore. This is intentional to enforce usage of the Thrift API for clients.

The library is supposed to be an API drop-in, it also supports a number of helper APIs from the hive-metastore dependency:

  • org.apache.hadoop.hive.metastore.MetaStoreUtils
  • org.apache.hadoop.hive.metastore.api.hive_metastoreConstants
  • org.apache.hadoop.hive.metastore.TableType
  • org.apache.hadoop.hive.metastore.MetaStoreFS
  • org.apache.hadoop.hive.metastore.ProtectMode
  • org.apache.hadoop.hive.metastore.Warehouse

All client pieces that are different from the Apache Hive Metastore are located in the com.facebook.hive.metastore package.

Usage

HiveMetastoreClientConfig metastoreConfig = new HiveMetastoreClientConfig();
try (ThriftClientManager clientManager = new ThriftClientManager()) {
    ThriftClientConfig clientConfig = new ThriftClientConfig();
    HiveMetastoreFactory factory = new SimpleHiveMetastoreFactory(clientManager, clientConfig, metastoreConfig);

    try (HiveMetastore metastore = factory.getDefaultClient()) {
        Table table = metastore.getTable("hello", "world");

    }
}

The Metastore API uses new API names (Java style). For drop-in compatibility, use

HiveMetastoreClientConfig metastoreConfig = new HiveMetastoreClientConfig();
try (ThriftClientManager clientManager = new ThriftClientManager()) {
    ThriftClientConfig clientConfig = new ThriftClientConfig();
    HiveMetastoreFactory factory = new SimpleHiveMetastoreFactory(clientManager, clientConfig, metastoreConfig);

    try (HiveMetastore metastore = factory.getDefaultClient()) {
        ThriftHiveMetastore.Client client = ThriftHiveMetastore.Client.forHiveMetastore(metastore);
        Table table = client.get_table("hello", "world");

    }
}

Using Guice

A Guice module is available that allows integration of the client using dependecy injection with Googl Guice. This requires the ThriftClientModule and the ThriftCodecModule from swift.

Injector inj = Guice.createInjector(Stage.PRODUCTION, 
                                    new HiveMetastoreClientModule(),
                                    new ThriftClientModule(),
                                    new ThriftCodecModule());

HiveMetastoreProvider provider = inj.getInstance(HiveMetastoreProvider.class);
HiveMetastore metastore = metastoreProvider.get();

Table table = metastore.getTable("hello", "world");
...

Known problems

Swift does not support unions yet. So ColumnStatisticsData, ColumnStatisticsObj and the associated API calls are not available. This will be fixed in the next release.

com.facebook

Facebook

We are working to build community through open source technology. NB: members must have two-factor auth.

Версии библиотеки

Версия
2.0
1.1
1.0