Search in sources :

Example 1 with TLDEventDataFilter

use of datawave.query.predicate.TLDEventDataFilter in project datawave by NationalSecurityAgency.

the class TermFrequencyIndexIteratorTest method testScanFullRangeExclusiveTLD.

@Test
public void testScanFullRangeExclusiveTLD() throws IOException, ParseException {
    Range r = new Range(getFiKey("row", "type1", "123.345.456", "FOO", "alf"), false, getFiKey("row", "type1", "123.345.456.2", "FOO", "buz"), false);
    filter = new TLDEventDataFilter(JexlASTHelper.parseJexlQuery("FOO=='bar' || FOO=='baz' || FOO=='buf' || FOO=='arm'"), typeMetadata, null, null, -1, -1, Collections.emptyMap(), null, fieldsToKeep);
    aggregator = new TLDTermFrequencyAggregator(fieldsToKeep, filter, -1);
    TermFrequencyIndexIterator iterator = new TermFrequencyIndexIterator(r, source, null, typeMetadata, true, null, aggregator);
    // jump to the first doc
    iterator.seek(null, null, true);
    Assert.assertTrue(iterator.hasTop());
    Document d = iterator.document();
    Assert.assertTrue(d != null);
    Assert.assertTrue(d.getDictionary().size() == 2);
    Assert.assertTrue(d.getDictionary().get("FOO") != null);
    Assert.assertTrue(d.getDictionary().get("RECORD_ID") != null);
    Assert.assertTrue(d.getDictionary().get("FOO").getData() != null);
    Iterator<PreNormalizedAttribute> i = ((Set) d.getDictionary().get("FOO").getData()).iterator();
    Assert.assertTrue(i.next().getValue().equals("bar"));
    Assert.assertTrue(i.next().getValue().equals("baz"));
    Assert.assertTrue(i.next().getValue().equals("buf"));
    Assert.assertTrue(i.next().getValue().equals("arm"));
    iterator.next();
    Assert.assertFalse(iterator.hasTop());
}
Also used : TLDEventDataFilter(datawave.query.predicate.TLDEventDataFilter) HashSet(java.util.HashSet) Set(java.util.Set) TLDTermFrequencyAggregator(datawave.query.tld.TLDTermFrequencyAggregator) PreNormalizedAttribute(datawave.query.attributes.PreNormalizedAttribute) Range(org.apache.accumulo.core.data.Range) Document(datawave.query.attributes.Document) Test(org.junit.Test)

Aggregations

Document (datawave.query.attributes.Document)1 PreNormalizedAttribute (datawave.query.attributes.PreNormalizedAttribute)1 TLDEventDataFilter (datawave.query.predicate.TLDEventDataFilter)1 TLDTermFrequencyAggregator (datawave.query.tld.TLDTermFrequencyAggregator)1 HashSet (java.util.HashSet)1 Set (java.util.Set)1 Range (org.apache.accumulo.core.data.Range)1 Test (org.junit.Test)1