Search in sources :

Example 1 with HiveTableDatasource

use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.

the class TerminateHiveTableFeed method completeOperation.

@Override
protected DataOperation completeOperation(ProcessContext context, FlowFile flowFile, Datasource dataset, DataOperation op, DataOperation.State state) {
    MetadataProvider provider = getProviderService(context).getProvider();
    if (state == State.SUCCESS) {
        HiveTableDatasource hds = (HiveTableDatasource) dataset;
        Dataset changeSet = provider.createDataset(hds, null);
        return provider.completeOperation(op.getId(), "", changeSet);
    } else {
        return provider.completeOperation(op.getId(), "", state);
    }
}
Also used : MetadataProvider(com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider) Dataset(com.thinkbiganalytics.metadata.rest.model.op.Dataset) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Example 2 with HiveTableDatasource

use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.

the class MetadataClientProviderTest method testEnsureHiveTableDatasource.

@Test
public void testEnsureHiveTableDatasource() {
    this.provider.ensureHiveTableDatasource("test7", "", "testdb", "test_table");
    Datasource ds = this.provider.getDatasourceByName("test7");
    assertThat(ds).isNotNull();
    assertThat(ds).isInstanceOf(HiveTableDatasource.class);
    String dsId = ds.getId();
    HiveTableDatasource dds = (HiveTableDatasource) ds;
    assertThat(dds.getTableName()).contains("test_table");
    ds = this.provider.ensureHiveTableDatasource("test7", "", "testdb", "test_table");
    assertThat(ds).isNotNull();
    assertThat(ds.getId()).isEqualTo(dsId);
}
Also used : DirectoryDatasource(com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource) Datasource(com.thinkbiganalytics.metadata.rest.model.data.Datasource) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource) Test(org.junit.Test)

Example 3 with HiveTableDatasource

use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.

the class MetadataClientTest method testAddFeedSource.

// @Test
public void testAddFeedSource() throws ParseException {
    Feed feed = buildFeed("category", "feed1").post();
    HiveTableDatasource ds = buildHiveTableDatasource("test-table").post();
    Feed result = client.addSource(feed.getId(), ds.getId());
    assertThat(result).isNotNull();
}
Also used : Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Example 4 with HiveTableDatasource

use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.

the class MetadataClientTest method testCompleteOperation.

// @Test
public void testCompleteOperation() throws ParseException {
    Feed feedA = buildFeed("category", "feedA").post();
    HiveTableDatasource dsA = buildHiveTableDatasource("test-table").post();
    feedA = client.addDestination(feedA.getId(), dsA.getId());
    Feed feedB = buildFeed("category", "feedB", "category", "feedA").post();
    feedB = client.addSource(feedB.getId(), dsA.getId());
    String destA = feedA.getDestinations().iterator().next().getId();
    DataOperation op = client.beginOperation(destA, "");
    op.setState(State.SUCCESS);
    HiveTablePartitions changeSet = new HiveTablePartitions();
    changeSet.setPartitions(Arrays.asList(new HiveTablePartition("month", null, "Jan", "Feb"), new HiveTablePartition("year", null, "2015", "2016")));
    Dataset dataset = new Dataset(new DateTime(), dsA, ChangeType.UPDATE, ContentType.PARTITIONS, changeSet);
    op.setDataset(dataset);
    op = client.updateDataOperation(op);
    assertThat(op).isNotNull();
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) HiveTablePartition(com.thinkbiganalytics.metadata.rest.model.data.HiveTablePartition) HiveTablePartitions(com.thinkbiganalytics.metadata.rest.model.op.HiveTablePartitions) Dataset(com.thinkbiganalytics.metadata.rest.model.op.Dataset) DateTime(org.joda.time.DateTime) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Example 5 with HiveTableDatasource

use of com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource in project kylo by Teradata.

the class MetadataClientTest method testBeginOperation.

// @Test
public void testBeginOperation() throws ParseException {
    Feed feed = buildFeed("category", "feed1").post();
    HiveTableDatasource ds = buildHiveTableDatasource("test-table").post();
    feed = client.addDestination(feed.getId(), ds.getId());
    String destId = feed.getDestinations().iterator().next().getId();
    DataOperation op = client.beginOperation(destId, "");
    assertThat(op).isNotNull();
}
Also used : DataOperation(com.thinkbiganalytics.metadata.rest.model.op.DataOperation) Feed(com.thinkbiganalytics.metadata.rest.model.feed.Feed) FeedExecutedSinceFeed(com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed) HiveTableDatasource(com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)

Aggregations

HiveTableDatasource (com.thinkbiganalytics.metadata.rest.model.data.HiveTableDatasource)8 FeedExecutedSinceFeed (com.thinkbiganalytics.metadata.api.sla.FeedExecutedSinceFeed)5 Feed (com.thinkbiganalytics.metadata.rest.model.feed.Feed)5 DataOperation (com.thinkbiganalytics.metadata.rest.model.op.DataOperation)3 Dataset (com.thinkbiganalytics.metadata.rest.model.op.Dataset)3 DateTime (org.joda.time.DateTime)2 Datasource (com.thinkbiganalytics.metadata.rest.model.data.Datasource)1 DirectoryDatasource (com.thinkbiganalytics.metadata.rest.model.data.DirectoryDatasource)1 HiveTablePartition (com.thinkbiganalytics.metadata.rest.model.data.HiveTablePartition)1 HiveTablePartitions (com.thinkbiganalytics.metadata.rest.model.op.HiveTablePartitions)1 ServiceLevelAssessment (com.thinkbiganalytics.metadata.rest.model.sla.ServiceLevelAssessment)1 MetadataProvider (com.thinkbiganalytics.nifi.core.api.metadata.MetadataProvider)1 Test (org.junit.Test)1