Search in sources :

Example 1 with SearchQueryBuilder

use of org.apache.druid.query.Druids.SearchQueryBuilder in project druid by druid-io.

the class SearchQueryRunnerWithCaseTest method testFallbackToCursorBasedPlan.

@Test
public void testFallbackToCursorBasedPlan() {
    final SearchQueryBuilder builder = testBuilder();
    final SearchQuery query = builder.filters("qualityLong", "1000").build();
    final Map<String, Set<String>> expectedResults = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
    expectedResults.put("qualityLong", Sets.newHashSet("1000"));
    expectedResults.put("qualityDouble", Sets.newHashSet("10000.0"));
    expectedResults.put("qualityFloat", Sets.newHashSet("10000.0"));
    expectedResults.put("qualityNumericString", Sets.newHashSet("100000"));
    expectedResults.put("longNumericNull", Sets.newHashSet("10"));
    expectedResults.put("floatNumericNull", Sets.newHashSet("10.0"));
    expectedResults.put("doubleNumericNull", Sets.newHashSet("10.0"));
    expectedResults.put("quality", Sets.newHashSet("AutoMotive", "automotive"));
    expectedResults.put("placement", Sets.newHashSet("PREFERRED", "preferred"));
    expectedResults.put("placementish", Sets.newHashSet("a", "preferred"));
    expectedResults.put("market", Sets.newHashSet("spot"));
    checkSearchQuery(query, expectedResults);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) SearchQueryBuilder(org.apache.druid.query.Druids.SearchQueryBuilder) TreeMap(java.util.TreeMap) InitializedNullHandlingTest(org.apache.druid.testing.InitializedNullHandlingTest) Test(org.junit.Test)

Example 2 with SearchQueryBuilder

use of org.apache.druid.query.Druids.SearchQueryBuilder in project druid by druid-io.

the class SearchBenchmark method setupQueries.

private void setupQueries() {
    // queries for the basic schema
    final Map<String, SearchQueryBuilder> basicQueries = new LinkedHashMap<>();
    final GeneratorSchemaInfo basicSchema = GeneratorBasicSchemas.SCHEMA_MAP.get("basic");
    final List<String> queryTypes = ImmutableList.of("A", "B", "C", "D");
    for (final String eachType : queryTypes) {
        basicQueries.put(eachType, makeQuery(eachType, basicSchema));
    }
    SCHEMA_QUERY_MAP.put("basic", basicQueries);
}
Also used : GeneratorSchemaInfo(org.apache.druid.segment.generator.GeneratorSchemaInfo) SearchQueryBuilder(org.apache.druid.query.Druids.SearchQueryBuilder) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

SearchQueryBuilder (org.apache.druid.query.Druids.SearchQueryBuilder)2 HashSet (java.util.HashSet)1 LinkedHashMap (java.util.LinkedHashMap)1 Set (java.util.Set)1 TreeMap (java.util.TreeMap)1 GeneratorSchemaInfo (org.apache.druid.segment.generator.GeneratorSchemaInfo)1 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)1 Test (org.junit.Test)1