Search in sources :

Example 16 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class QueryPruningVisitorTest method RENoFieldTest.

@Test
public void RENoFieldTest() throws ParseException {
    String query = "_NOFIELD_ =~ 'x'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(query);
    Assert.assertEquals(QueryPruningVisitor.TruthState.FALSE, QueryPruningVisitor.getState(script));
    Assert.assertEquals(0, logAppender.getMessages().size(), logAppender.getMessages().size());
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 17 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class QueryPruningVisitorTest method markerBoundedRangeTest.

@Test
public void markerBoundedRangeTest() throws ParseException {
    String query = "((Assignment = true) && (FIELD > 'x' && FIELD < 'z'))";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(query);
    Assert.assertEquals(QueryPruningVisitor.TruthState.UNKNOWN, QueryPruningVisitor.getState(script));
    Assert.assertEquals(query, JexlStringBuildingVisitor.buildQuery(QueryPruningVisitor.reduce(script, false)));
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 18 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class QueryPruningVisitorTest method notTrueTest.

@Test
public void notTrueTest() throws ParseException {
    String query = "!true";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(query);
    Assert.assertEquals(QueryPruningVisitor.TruthState.FALSE, QueryPruningVisitor.getState(script));
    Assert.assertEquals(0, logAppender.getMessages().size(), logAppender.getMessages().size());
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 19 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class QueryPruningVisitorTest method GETest.

@Test
public void GETest() throws ParseException {
    String query = "FIELD >= 'x'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(query);
    Assert.assertEquals(QueryPruningVisitor.TruthState.UNKNOWN, QueryPruningVisitor.getState(script));
    Assert.assertEquals(0, logAppender.getMessages().size(), logAppender.getMessages().size());
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Example 20 with ParseException

use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.

the class QueryPruningVisitorTest method GTTest.

@Test
public void GTTest() throws ParseException {
    String query = "FIELD > 'x'";
    ASTJexlScript script = JexlASTHelper.parseJexlQuery(query);
    Assert.assertEquals(QueryPruningVisitor.TruthState.UNKNOWN, QueryPruningVisitor.getState(script));
    Assert.assertEquals(0, logAppender.getMessages().size(), logAppender.getMessages().size());
}
Also used : ASTJexlScript(org.apache.commons.jexl2.parser.ASTJexlScript) Test(org.junit.Test)

Aggregations

ASTJexlScript (org.apache.commons.jexl2.parser.ASTJexlScript)258 Test (org.junit.Test)214 JexlNode (org.apache.commons.jexl2.parser.JexlNode)56 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)36 Date (java.util.Date)33 ParseException (org.apache.commons.jexl2.parser.ParseException)18 HashSet (java.util.HashSet)14 Key (org.apache.accumulo.core.data.Key)9 ArrayList (java.util.ArrayList)7 DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)6 IOException (java.io.IOException)5 ASTERNode (org.apache.commons.jexl2.parser.ASTERNode)5 MockMetadataHelper (datawave.query.util.MockMetadataHelper)4 PartialKey (org.apache.accumulo.core.data.PartialKey)4 Document (datawave.query.attributes.Document)3 JexlEvaluation (datawave.query.function.JexlEvaluation)3 DatawaveJexlContext (datawave.query.jexl.DatawaveJexlContext)3 DefaultArithmetic (datawave.query.jexl.DefaultArithmetic)3 StringReader (java.io.StringReader)3 AbstractMap (java.util.AbstractMap)3