Search in sources :

Example 1 with PrimitiveComparison

use of org.apache.hadoop.hive.accumulo.predicate.compare.PrimitiveComparison in project hive by apache.

the class PrimitiveComparisonFilter method init.

@Override
public void init(SortedKeyValueIterator<Key, Value> source, Map<String, String> options, IteratorEnvironment env) throws IOException {
    super.init(source, options, env);
    String serializedColumnMapping = options.get(COLUMN);
    Entry<String, String> pair = ColumnMappingFactory.parseMapping(serializedColumnMapping);
    // The ColumnEncoding, column name and type are all irrelevant at this point, just need the
    // cf:[cq]
    columnMapping = new HiveAccumuloColumnMapping(pair.getKey(), pair.getValue(), ColumnEncoding.STRING, "column", "string");
    columnMappingFamily = new Text(columnMapping.getColumnFamily());
    columnMappingQualifier = new Text(columnMapping.getColumnQualifier());
    cfHolder = new Text();
    cqHolder = new Text();
    try {
        Class<?> pClass = JavaUtils.loadClass(options.get(P_COMPARE_CLASS));
        Class<?> cClazz = JavaUtils.loadClass(options.get(COMPARE_OPT_CLASS));
        PrimitiveComparison pCompare = pClass.asSubclass(PrimitiveComparison.class).newInstance();
        compOpt = cClazz.asSubclass(CompareOp.class).newInstance();
        byte[] constant = getConstant(options);
        pCompare.init(constant);
        compOpt.setPrimitiveCompare(pCompare);
    } catch (ClassNotFoundException e) {
        throw new IOException(e);
    } catch (InstantiationException e) {
        throw new IOException(e);
    } catch (IllegalAccessException e) {
        throw new IOException(e);
    }
}
Also used : PrimitiveComparison(org.apache.hadoop.hive.accumulo.predicate.compare.PrimitiveComparison) Text(org.apache.hadoop.io.Text) IOException(java.io.IOException) HiveAccumuloColumnMapping(org.apache.hadoop.hive.accumulo.columns.HiveAccumuloColumnMapping)

Aggregations

IOException (java.io.IOException)1 HiveAccumuloColumnMapping (org.apache.hadoop.hive.accumulo.columns.HiveAccumuloColumnMapping)1 PrimitiveComparison (org.apache.hadoop.hive.accumulo.predicate.compare.PrimitiveComparison)1 Text (org.apache.hadoop.io.Text)1