Search in sources :

Example 76 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class RESTPubSubTest method testGetPublisher.

@Test
public void testGetPublisher() throws PubSubException {
    BulletConfig config = new BulletConfig("src/test/resources/test_config.yaml");
    config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_SUBMISSION");
    RESTPubSub pubSub = new RESTPubSub(config);
    Publisher publisher = pubSub.getPublisher();
    Assert.assertNotNull(publisher);
    Assert.assertTrue(publisher instanceof RESTQueryPublisher);
    config.set(BulletConfig.PUBSUB_CONTEXT_NAME, "QUERY_PROCESSING");
    pubSub = new RESTPubSub(config);
    publisher = pubSub.getPublisher();
    Assert.assertNotNull(publisher);
    Assert.assertTrue(publisher instanceof RESTResultPublisher);
}
Also used : Publisher(com.yahoo.bullet.pubsub.Publisher) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 77 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class AggregationOperationsTest method testDistinctStrategy.

@Test
public void testDistinctStrategy() {
    Aggregation aggregation = new Aggregation();
    BulletConfig config = new BulletConfig();
    aggregation.setType(Aggregation.Type.GROUP);
    aggregation.setFields(singletonMap("field", "foo"));
    aggregation.configure(config);
    Assert.assertEquals(AggregationOperations.findStrategy(aggregation, config).getClass(), GroupBy.class);
}
Also used : Aggregation(com.yahoo.bullet.parsing.Aggregation) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 78 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class AggregationOperationsTest method testGroupAllStrategy.

@Test
public void testGroupAllStrategy() {
    Aggregation aggregation = new Aggregation();
    BulletConfig config = new BulletConfig();
    aggregation.setType(Aggregation.Type.GROUP);
    aggregation.setAttributes(singletonMap(GroupOperation.OPERATIONS, singletonList(singletonMap(GroupOperation.OPERATION_TYPE, GroupOperation.GroupOperationType.COUNT.getName()))));
    aggregation.configure(config);
    Assert.assertEquals(AggregationOperations.findStrategy(aggregation, config).getClass(), GroupAll.class);
}
Also used : Aggregation(com.yahoo.bullet.parsing.Aggregation) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 79 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class AggregationOperationsTest method testRawStrategy.

@Test
public void testRawStrategy() {
    Aggregation aggregation = new Aggregation();
    BulletConfig config = new BulletConfig();
    aggregation.configure(config);
    Assert.assertEquals(AggregationOperations.findStrategy(aggregation, config).getClass(), Raw.class);
}
Also used : Aggregation(com.yahoo.bullet.parsing.Aggregation) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 80 with BulletConfig

use of com.yahoo.bullet.common.BulletConfig in project bullet-core by yahoo.

the class AggregationOperationsTest method testDistributionStrategy.

@Test
public void testDistributionStrategy() {
    Aggregation aggregation = new Aggregation();
    BulletConfig config = new BulletConfig();
    aggregation.setType(Aggregation.Type.DISTRIBUTION);
    aggregation.setFields(singletonMap("field", "foo"));
    aggregation.configure(config);
    Assert.assertEquals(AggregationOperations.findStrategy(aggregation, config).getClass(), Distribution.class);
}
Also used : Aggregation(com.yahoo.bullet.parsing.Aggregation) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Aggregations

BulletConfig (com.yahoo.bullet.common.BulletConfig)101 Test (org.testng.annotations.Test)87 Aggregation (com.yahoo.bullet.parsing.Aggregation)37 List (java.util.List)25 Query (com.yahoo.bullet.parsing.Query)20 QueryUtils.makeAggregationQuery (com.yahoo.bullet.parsing.QueryUtils.makeAggregationQuery)17 BulletError (com.yahoo.bullet.common.BulletError)16 BulletRecord (com.yahoo.bullet.record.BulletRecord)16 Arrays.asList (java.util.Arrays.asList)16 Clip (com.yahoo.bullet.result.Clip)14 Collections.singletonList (java.util.Collections.singletonList)12 QueryUtils.makeProjectionFilterQuery (com.yahoo.bullet.parsing.QueryUtils.makeProjectionFilterQuery)11 QueryUtils.makeRawFullQuery (com.yahoo.bullet.parsing.QueryUtils.makeRawFullQuery)11 Map (java.util.Map)11 AggregationUtils.makeAttributes (com.yahoo.bullet.parsing.AggregationUtils.makeAttributes)10 Window (com.yahoo.bullet.parsing.Window)10 Concept (com.yahoo.bullet.result.Meta.Concept)10 RecordBox (com.yahoo.bullet.result.RecordBox)10 ArrayList (java.util.ArrayList)10 IntStream (java.util.stream.IntStream)10