Search in sources :

Example 1 with ColumnSet

use of org.apache.accumulo.core.iterators.conf.ColumnSet in project teiid by teiid.

the class BaseFilterIterator method init.

@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    String cf = options.get(AccumuloMetadataProcessor.CF);
    String cq = options.get(AccumuloMetadataProcessor.CQ);
    if (options.get(AccumuloMetadataProcessor.VALUE_IN) != null) {
        String value = options.get(AccumuloMetadataProcessor.VALUE_IN);
        this.valueIn = AccumuloMetadataProcessor.ValueIn.valueOf(value.substring(1, value.length() - 1));
    } else {
        this.valueIn = AccumuloMetadataProcessor.ValueIn.VALUE;
    }
    if (cq != null) {
        // $NON-NLS-1$
        this.columnFilter = new ColumnSet(Arrays.asList(cf + ":" + cq));
    } else {
        this.columnFilter = new ColumnSet(Arrays.asList(cf));
    }
    this.negate = false;
    if (options.get(NEGATE) != null) {
        this.negate = Boolean.parseBoolean(options.get(NEGATE));
    }
}
Also used : ColumnSet(org.apache.accumulo.core.iterators.conf.ColumnSet)

Example 2 with ColumnSet

use of org.apache.accumulo.core.iterators.conf.ColumnSet in project Gaffer by gchq.

the class CoreKeyGroupByCombiner method init.

@Override
public void init(final SortedKeyValueIterator<Key, Value> source, final Map<String, String> options, final IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    try {
        schema = Schema.fromJson(options.get(AccumuloStoreConstants.SCHEMA).getBytes(CommonConstants.UTF_8));
    } catch (final UnsupportedEncodingException e) {
        throw new SchemaException("Unable to deserialise the schema", e);
    }
    LOGGER.debug("Initialising CoreKeyGroupByCombiner with schema {}", schema);
    try {
        view = View.fromJson(options.get(AccumuloStoreConstants.VIEW).getBytes(CommonConstants.UTF_8));
    } catch (final UnsupportedEncodingException e) {
        throw new SchemaException("Unable to deserialise the view", e);
    }
    LOGGER.debug("Initialising CoreKeyGroupByCombiner with view {}", view);
    final String elementConverterClass = options.get(AccumuloStoreConstants.ACCUMULO_ELEMENT_CONVERTER_CLASS);
    try {
        elementConverter = Class.forName(elementConverterClass).asSubclass(AccumuloElementConverter.class).getConstructor(Schema.class).newInstance(schema);
        LOGGER.debug("Creating AccumuloElementConverter of class {}", elementConverterClass);
    } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
        throw new AggregationException("Failed to create element converter of the class name provided (" + elementConverterClass + ")", e);
    }
    final String encodedColumns = options.get(COLUMNS_OPTION);
    if (StringUtils.isNotEmpty(encodedColumns)) {
        aggregatedGroups = new ColumnSet(Lists.newArrayList(Splitter.on(",").split(encodedColumns)));
        LOGGER.debug("Setting aggregatedGroups to {}", aggregatedGroups);
    }
}
Also used : SchemaException(uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException) AggregationException(uk.gov.gchq.gaffer.accumulostore.key.exception.AggregationException) UnsupportedEncodingException(java.io.UnsupportedEncodingException) ColumnSet(org.apache.accumulo.core.iterators.conf.ColumnSet) InvocationTargetException(java.lang.reflect.InvocationTargetException) AccumuloElementConverter(uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter)

Aggregations

ColumnSet (org.apache.accumulo.core.iterators.conf.ColumnSet)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 AccumuloElementConverter (uk.gov.gchq.gaffer.accumulostore.key.AccumuloElementConverter)1 AggregationException (uk.gov.gchq.gaffer.accumulostore.key.exception.AggregationException)1 SchemaException (uk.gov.gchq.gaffer.data.elementdefinition.exception.SchemaException)1