AccumuloStoreRelation extends BaseRelation implements TableScan, PrunedScan, PrunedFilteredScan { @Override public RDD<Row> buildScan() { try { LOGGER.info("Building GetRDDOfAllElements with view set to groups {}", StringUtils.join(groups, ',')); final GetRDDOfAllElements operation = new GetRDDOfAllElements(); operation.setView(view); operation.setOptions(options); final RDD<Element> rdd = store.execute(operation, context); return rdd.map(new ConvertElementToRow(usedProperties, propertyNeedsConversion, converterByProperty), ClassTagConstants.ROW_CLASS_TAG); } catch (final OperationException e) { LOGGER.error("OperationException while executing operation: {}", e); return null; } } AccumuloStoreRelation(final Context context,
                                 final List<Converter> converters,
                                 final View view,
                                 final AccumuloStore store,
                                 final Map<String, String> options); @Override SQLContext sqlContext(); @Override StructType schema(); @Override RDD<Row> buildScan(); @Override RDD<Row> buildScan(final String[] requiredColumns); @Override RDD<Row> buildScan(final String[] requiredColumns, final Filter[] filters);  }
@Test public void shouldReturnEmptyDataFrameWithNoResultsFromFilter() throws StoreException, OperationException { final SparkSession sparkSession = SparkSessionProvider.getSparkSession(); final Schema schema = getSchema(); final View view = getViewFromSchema(schema); final SingleUseAccumuloStore store = new SingleUseAccumuloStore(); store.initialise("graphId", schema, getStoreProperties()); addElements(store); final String[] requiredColumns = new String[1]; requiredColumns[0] = "property1"; final Filter[] filters = new Filter[1]; filters[0] = new EqualTo("group", "abc"); final AccumuloStoreRelation relation = new AccumuloStoreRelation( SparkContextUtil.createContext(new User(), sparkSession), Collections.emptyList(), view, store, null); final RDD<Row> rdd = relation.buildScan(requiredColumns, filters); assertTrue(rdd.isEmpty()); }