Search in sources :

Example 1 with DataSetProvider

use of com.thinkbiganalytics.kylo.catalog.spi.DataSetProvider in project kylo by Teradata.

the class DefaultKyloCatalogReader method load.

@Nonnull
@Override
public T load() {
    Preconditions.checkNotNull(options.getFormat(), "Format must be defined");
    // Find data set provider
    final Option<DataSetProvider<T>> provider = client.getDataSetProvider(options.getFormat());
    if (!provider.isDefined()) {
        throw new KyloCatalogException("Format is not supported: " + options.getFormat());
    }
    // Load data set
    try {
        return resourceLoader.runWithThreadContext(new Callable<T>() {

            @Override
            public T call() {
                return provider.get().read(client, options);
            }
        });
    } catch (final Exception e) {
        throw new KyloCatalogException("Unable to load '" + options.getFormat() + "' source: " + e, e);
    }
}
Also used : KyloCatalogException(com.thinkbiganalytics.kylo.catalog.api.KyloCatalogException) DataSetProvider(com.thinkbiganalytics.kylo.catalog.spi.DataSetProvider) KyloCatalogException(com.thinkbiganalytics.kylo.catalog.api.KyloCatalogException) Nonnull(javax.annotation.Nonnull)

Aggregations

KyloCatalogException (com.thinkbiganalytics.kylo.catalog.api.KyloCatalogException)1 DataSetProvider (com.thinkbiganalytics.kylo.catalog.spi.DataSetProvider)1 Nonnull (javax.annotation.Nonnull)1