use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToOneIntersectsTest.
@Test
public void oneToOneIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && TOPPINGS == 'HOT_FUDGE'";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(singleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method reverseOneToOneAltFieldIntersectsTest.
@Test
public void reverseOneToOneAltFieldIntersectsTest() throws ParseException {
String query = "FIXINGS == 'HOT_FUDGE' && geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(singleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method manyToOneIntersectsTest.
@Test
public void manyToOneIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (TOPPINGS == 'PEANUT' || TOPPINGS == 'PISTACHIO' || TOPPINGS == 'CASHEW')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(manyToOneFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("geowave:intersects(NUT_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToManyIntersectsDistributedUnchangedTest.
@Test
public void oneToManyIntersectsDistributedUnchangedTest() throws ParseException {
String query = "FIELD == 'VALUE' && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("FIELD == 'VALUE' && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of org.apache.commons.jexl2.parser.ParseException in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method reverseOneToManyIntersectsTest.
@Test
public void reverseOneToManyIntersectsTest() throws ParseException {
String query = "(TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA') && geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')";
ShardQueryConfiguration config = new ShardQueryConfiguration();
config.setWhindexMappingFields(mappingFields);
config.setWhindexFieldMappings(multipleFieldMapping);
ASTJexlScript jexlScript = JexlASTHelper.parseJexlQuery(query);
jexlScript = WhindexVisitor.apply(jexlScript, config, new Date(), metadataHelper);
Assert.assertEquals("geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') || geowave:intersects(BANANA_SPLIT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
Aggregations