use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method incompleteMappingIntersectsTest.
@Test
public void incompleteMappingIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA' || TOPPINGS == 'CHERRY')";
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(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && TOPPINGS == 'CHERRY') || 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));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method reverseOneToOneIntersectsWithTermsAndRangesTest.
@Test
public void reverseOneToOneIntersectsWithTermsAndRangesTest() throws ParseException {
String query = "TOPPINGS == 'HOT_FUDGE' && ((ICE_CREAM == '0100' || ((BoundedRange = true) && (ICE_CREAM >= '0102' && ICE_CREAM <= '0103'))) && 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))') && (HOT_FUDGE_SUNDAE == '0100' || ((BoundedRange = true) && (HOT_FUDGE_SUNDAE >= '0102' && HOT_FUDGE_SUNDAE <= '0103')))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToOneIntersectsWithTermsAndRangesTest.
@Test
public void oneToOneIntersectsWithTermsAndRangesTest() throws ParseException {
String query = "(geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (ICE_CREAM == '0100' || ((BoundedRange = true) && (ICE_CREAM >= '0102' && ICE_CREAM <= '0103')))) && 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))') && (HOT_FUDGE_SUNDAE == '0100' || ((BoundedRange = true) && (HOT_FUDGE_SUNDAE >= '0102' && HOT_FUDGE_SUNDAE <= '0103')))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToOneNestedReverseIntersectsTest.
@Test
public void oneToOneNestedReverseIntersectsTest() throws ParseException {
String query = "(TOPPINGS == 'HOT_FUDGE' || FIELD == 'blah') && 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(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && FIELD == 'blah') || geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToManyIntersectsTest.
@Test
public void oneToManyIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && (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("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