Search in sources :

Example 21 with LuceneToJexlQueryParser

use of datawave.query.language.parser.jexl.LuceneToJexlQueryParser in project datawave by NationalSecurityAgency.

the class GroupingTest method testGroupingUsingLuceneFunctionWithDuplicateValues.

@Test
public void testGroupingUsingLuceneFunctionWithDuplicateValues() throws Exception {
    Map<String, String> extraParameters = new HashMap<>();
    extraParameters.put("group.fields.batch.size", "6");
    Date startDate = format.parse("20091231");
    Date endDate = format.parse("20150101");
    String queryString = "(UUID:CORLEONE) and #GROUPBY('AGE','BIRTHDAY')";
    // @formatter:off
    Map<String, Integer> expectedMap = ImmutableMap.<String, Integer>builder().put("4-18", 1).put("5-40", 1).put("3-20", 1).put("1-24", 1).put("2-22", 1).put("22-22", 1).build();
    // @formatter:on
    logic.setParser(new LuceneToJexlQueryParser());
    for (RebuildingScannerTestHelper.TEARDOWN teardown : TEARDOWNS) {
        for (RebuildingScannerTestHelper.INTERRUPT interrupt : INTERRUPTS) {
            runTestQueryWithGrouping(expectedMap, queryString, startDate, endDate, extraParameters, teardown, interrupt);
        }
    }
    logic.setParser(new JexlControlledQueryParser());
}
Also used : HashMap(java.util.HashMap) RebuildingScannerTestHelper(datawave.query.RebuildingScannerTestHelper) LuceneToJexlQueryParser(datawave.query.language.parser.jexl.LuceneToJexlQueryParser) Date(java.util.Date) JexlControlledQueryParser(datawave.query.language.parser.jexl.JexlControlledQueryParser) Test(org.junit.Test)

Aggregations

LuceneToJexlQueryParser (datawave.query.language.parser.jexl.LuceneToJexlQueryParser)21 Test (org.junit.Test)17 HashMap (java.util.HashMap)11 List (java.util.List)7 Date (java.util.Date)5 RebuildingScannerTestHelper (datawave.query.RebuildingScannerTestHelper)3 JexlControlledQueryParser (datawave.query.language.parser.jexl.JexlControlledQueryParser)3 QueryNode (datawave.query.language.tree.QueryNode)3 Type (datawave.data.type.Type)2 ASTJexlScript (org.apache.commons.jexl2.parser.ASTJexlScript)2 Stopwatch (com.google.common.base.Stopwatch)1 HashMultimap (com.google.common.collect.HashMultimap)1 Multimap (com.google.common.collect.Multimap)1 ShardIndexQueryConfiguration (datawave.query.config.ShardIndexQueryConfiguration)1 QueryValues (datawave.query.discovery.FindLiteralsAndPatternsVisitor.QueryValues)1 EmptyUnfieldedTermExpansionException (datawave.query.exceptions.EmptyUnfieldedTermExpansionException)1 ShardIndexQueryTableStaticMethods (datawave.query.jexl.lookups.ShardIndexQueryTableStaticMethods)1 EvaluationOnly (datawave.query.language.functions.jexl.EvaluationOnly)1 JexlQueryFunction (datawave.query.language.functions.jexl.JexlQueryFunction)1 QueryParser (datawave.query.language.parser.QueryParser)1