use of datawave.query.planner.DefaultQueryPlanner in project datawave by NationalSecurityAgency.
the class IfThisTestFailsThenHitTermsAreBroken method setup.
@Before
public void setup() throws Exception {
TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
File tempDir = temporaryFolder.newFolder();
System.setProperty("type.metadata.dir", tempDir.getAbsolutePath());
System.setProperty("dw.metadatahelper.all.auths", "A,B,C,D,T,U,V,W,X,Y,Z");
log.info("using tempFolder " + tempDir);
logic = new ShardQueryLogic();
logic.setMetadataTableName(QueryTestTableHelper.MODEL_TABLE_NAME);
logic.setTableName(TableName.SHARD);
logic.setIndexTableName(TableName.SHARD_INDEX);
logic.setReverseIndexTableName(TableName.SHARD_RINDEX);
logic.setMaxResults(5000);
logic.setMaxWork(25000);
logic.setModelTableName(QueryTestTableHelper.MODEL_TABLE_NAME);
logic.setQueryPlanner(new DefaultQueryPlanner());
logic.setIncludeGroupingContext(true);
logic.setMarkingFunctions(new MarkingFunctions.Default());
logic.setMetadataHelperFactory(new MetadataHelperFactory());
logic.setDateIndexHelperFactory(new DateIndexHelperFactory());
logic.setMaxEvaluationPipelines(1);
deserializer = new KryoDocumentDeserializer();
}
use of datawave.query.planner.DefaultQueryPlanner in project datawave by NationalSecurityAgency.
the class AnyFieldQueryTest method testRegexPushdownField.
@Test
public void testRegexPushdownField() throws Exception {
String roPhrase = RE_OP + "'ro.*'";
String anyRo = this.dataManager.convertAnyField(roPhrase);
String yPhrase = RE_OP + "'.*y'";
String cityY = CityField.COUNTRY + yPhrase;
String query = Constants.ANY_FIELD + roPhrase + AND_OP + CityField.COUNTRY + yPhrase;
RegexPushdownTransformRule rule = new RegexPushdownTransformRule();
rule.setRegexPatterns(Arrays.asList("\\.\\*[0-9a-zA-Z]", "[0-9a-zA-Z]\\.\\*"));
((DefaultQueryPlanner) (logic.getQueryPlanner())).setTransformRules(Collections.singletonList(rule));
// Test the plan with all expansions
String expect = CityField.CITY.name() + EQ_OP + "'rome'" + JEXL_AND_OP + "((_Eval_ = true) && (" + cityY + "))";
String plan = getPlan(query, true, true);
assertPlanEquals(expect, plan);
expect = Constants.ANY_FIELD + EQ_OP + "'rome'" + JEXL_AND_OP + "((_Eval_ = true) && (" + cityY + "))";
plan = getPlan(query, false, true);
assertPlanEquals(expect, plan);
expect = CityField.CITY + roPhrase + JEXL_AND_OP + "((_Eval_ = true) && (" + cityY + "))";
plan = getPlan(query, true, false);
assertPlanEquals(expect, plan);
// test running the query
expect = anyRo + AND_OP + cityY;
runTest(query, expect);
}
Aggregations