use of org.apache.spark.sql.sources.EqualTo in project Gaffer by gchq.
the class FilterToOperationConverterTest method testSpecifyDestination.
@Test
public void testSpecifyDestination() throws OperationException {
final Schema schema = getSchema();
final SQLContext sqlContext = getSqlContext("testSpecifyDestination");
final Filter[] filters = new Filter[1];
filters[0] = new EqualTo(SchemaToStructTypeConverter.DST_COL_NAME, "0");
final FiltersToOperationConverter converter = new FiltersToOperationConverter(sqlContext, getViewFromSchema(schema), schema, filters);
final AbstractGetRDD<?> operation = converter.getOperation();
assertTrue(operation instanceof GetRDDOfElements);
assertEquals(0, operation.getView().getEntityGroups().size());
assertEquals(EDGE_GROUPS, operation.getView().getEdgeGroups());
final Set<EntitySeed> seeds = new HashSet<>();
for (final Object seed : ((GetRDDOfElements) operation).getSeeds()) {
seeds.add((EntitySeed) seed);
}
assertEquals(Collections.singleton(new EntitySeed("0")), seeds);
sqlContext.sparkContext().stop();
}
use of org.apache.spark.sql.sources.EqualTo in project Gaffer by gchq.
the class FilterToOperationConverterTest method testTwoGroups.
@Test
public void testTwoGroups() throws OperationException {
final Schema schema = getSchema();
final SQLContext sqlContext = getSqlContext("testTwoGroups");
final Filter[] filters = new Filter[1];
final Filter left = new EqualTo(SchemaToStructTypeConverter.GROUP, ENTITY_GROUP);
final Filter right = new EqualTo(SchemaToStructTypeConverter.GROUP, EDGE_GROUP2);
filters[0] = new Or(left, right);
final FiltersToOperationConverter converter = new FiltersToOperationConverter(sqlContext, getViewFromSchema(schema), schema, filters);
final AbstractGetRDD<?> operation = converter.getOperation();
assertTrue(operation instanceof GetRDDOfAllElements);
assertEquals(Collections.singleton(ENTITY_GROUP), operation.getView().getEntityGroups());
assertEquals(Collections.singleton(EDGE_GROUP2), operation.getView().getEdgeGroups());
sqlContext.sparkContext().stop();
}
Aggregations