use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method manyToManyUniqueIntersectsTest.
@Test
public void manyToManyUniqueIntersectsTest() throws ParseException {
String query = "(geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') || geowave:intersects(ICE_CREAM, 'POLYGON((-20 -20, 20 -20, 20 20, -20 20, -20 -20))')) && (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(HOT_FUDGE_SUNDAE, 'POLYGON((-20 -20, 20 -20, 20 20, -20 20, -20 -20))')) || (geowave:intersects(BANANA_SPLIT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') || geowave:intersects(BANANA_SPLIT, 'POLYGON((-20 -20, 20 -20, 20 20, -20 20, -20 -20))'))", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method reverseIncompleteMappingIntersectsTest.
@Test
public void reverseIncompleteMappingIntersectsTest() throws ParseException {
String query = "(TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA' || TOPPINGS == 'CHERRY') && 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(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 manyToManyMultipleIntersectsTest.
@Test
public void manyToManyMultipleIntersectsTest() throws ParseException {
String query = "geowave:intersects((ICE_CREAM || SHERBERT), 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && TOPPINGS == 'PEANUT' && (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("(TOPPINGS == 'PEANUT' && ((TOPPINGS == 'HOT_FUDGE' && geowave:intersects(SHERBERT, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))')) || geowave:intersects(HOT_FUDGE_SUNDAE, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))'))) || (TOPPINGS == 'PEANUT' && ((TOPPINGS == 'BANANA' && geowave:intersects(SHERBERT, '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 reverseOneToManyIntersectsDistributedUnchangedTest.
@Test
public void reverseOneToManyIntersectsDistributedUnchangedTest() throws ParseException {
String query = "(TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA') && FIELD == 'VALUE'";
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("(TOPPINGS == 'HOT_FUDGE' || TOPPINGS == 'BANANA') && FIELD == 'VALUE'", JexlStringBuildingVisitor.buildQuery(jexlScript));
}
use of datawave.query.config.ShardQueryConfiguration in project datawave by NationalSecurityAgency.
the class WhindexVisitorTest method oneToOneAltFieldIntersectsTest.
@Test
public void oneToOneAltFieldIntersectsTest() throws ParseException {
String query = "geowave:intersects(ICE_CREAM, 'POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10))') && FIXINGS == '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));
}
Aggregations