Search in sources :

Example 31 with ASTJexlScript

use of org.apache.commons.jexl3.parser.ASTJexlScript 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 32 with ASTJexlScript

use of org.apache.commons.jexl3.parser.ASTJexlScript 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 33 with ASTJexlScript

use of org.apache.commons.jexl3.parser.ASTJexlScript 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 34 with ASTJexlScript

use of org.apache.commons.jexl3.parser.ASTJexlScript 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 35 with ASTJexlScript

use of org.apache.commons.jexl3.parser.ASTJexlScript 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)457 Test (org.junit.Test)385 Key (org.apache.accumulo.core.data.Key)69 JexlNode (org.apache.commons.jexl2.parser.JexlNode)61 HashSet (java.util.HashSet)50 ShardQueryConfiguration (datawave.query.config.ShardQueryConfiguration)48 MockMetadataHelper (datawave.query.util.MockMetadataHelper)40 Type (datawave.data.type.Type)38 LcNoDiacriticsType (datawave.data.type.LcNoDiacriticsType)37 ArrayList (java.util.ArrayList)37 ExpressionFilter (datawave.query.jexl.visitors.EventDataQueryExpressionVisitor.ExpressionFilter)36 ScannerFactory (datawave.query.tables.ScannerFactory)35 Date (java.util.Date)35 NoOpType (datawave.data.type.NoOpType)34 NumberType (datawave.data.type.NumberType)34 AbstractMap (java.util.AbstractMap)32 Range (org.apache.accumulo.core.data.Range)30 Value (org.apache.accumulo.core.data.Value)29 RangeFactoryForTests.makeTestRange (datawave.common.test.utils.query.RangeFactoryForTests.makeTestRange)26 QueryPlan (datawave.query.planner.QueryPlan)26