Search in sources :

Example 11 with DefaultQueryPlanner

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();
}
Also used : KryoDocumentDeserializer(datawave.query.function.deserializer.KryoDocumentDeserializer) ShardQueryLogic(datawave.query.tables.ShardQueryLogic) DefaultQueryPlanner(datawave.query.planner.DefaultQueryPlanner) File(java.io.File) MarkingFunctions(datawave.marking.MarkingFunctions) MetadataHelperFactory(datawave.query.util.MetadataHelperFactory) DateIndexHelperFactory(datawave.query.util.DateIndexHelperFactory) Before(org.junit.Before)

Example 12 with DefaultQueryPlanner

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);
}
Also used : DefaultQueryPlanner(datawave.query.planner.DefaultQueryPlanner) RegexPushdownTransformRule(datawave.query.planner.rules.RegexPushdownTransformRule) Test(org.junit.Test)

Aggregations

DefaultQueryPlanner (datawave.query.planner.DefaultQueryPlanner)12 ShardQueryLogic (datawave.query.tables.ShardQueryLogic)5 DateIndexHelperFactory (datawave.query.util.DateIndexHelperFactory)4 MetadataHelperFactory (datawave.query.util.MetadataHelperFactory)4 Before (org.junit.Before)4 MarkingFunctions (datawave.marking.MarkingFunctions)3 URL (java.net.URL)3 Test (org.junit.Test)3 KryoDocumentDeserializer (datawave.query.function.deserializer.KryoDocumentDeserializer)2 RegexPushdownTransformRule (datawave.query.planner.rules.RegexPushdownTransformRule)2 DatawavePrincipal (datawave.security.authorization.DatawavePrincipal)2 DatawaveUser (datawave.security.authorization.DatawaveUser)2 SubjectIssuerDNPair (datawave.security.authorization.SubjectIssuerDNPair)2 DefaultResponseObjectFactory (datawave.webservice.query.result.event.DefaultResponseObjectFactory)2 Default (datawave.marking.MarkingFunctions.Default)1 DatawaveFatalQueryException (datawave.query.exceptions.DatawaveFatalQueryException)1 FullTableScansDisallowedException (datawave.query.exceptions.FullTableScansDisallowedException)1 MetadataHelperQueryModelProvider (datawave.query.planner.MetadataHelperQueryModelProvider)1 QueryModelProvider (datawave.query.planner.QueryModelProvider)1 QueryPlanner (datawave.query.planner.QueryPlanner)1