/** * Construct an DefaultSqlAggregationType with a keyword to look for in a * druid aggregation types, i.e. {"longSum", "doubleMin"}. * * @param sqlAggFunction The aggregation function that should be performed. * @param aliases The druid aggregation type. */ DefaultSqlAggregationType(SqlAggFunction sqlAggFunction, String... aliases) { this.sqlAggFunction = sqlAggFunction; this.validDruidAggregations = Utils.asLinkedHashSet(aliases); }
/** * Get the Druid Metric Names by the logical table they should be present in. * * @param logicalTable Logical table for which to get the DruidMetricNames * * @return the Druid metric names for that logical table */ public static Set<FieldName> getByLogicalTable(TestLogicalTableName logicalTable) { switch (logicalTable) { case SHAPES: return Utils.asLinkedHashSet(HEIGHT, WIDTH, DEPTH, USERS); case PETS: return Utils.asLinkedHashSet(LIMBS); case MONTHLY: case HOURLY: return Utils.asLinkedHashSet(LIMBS); } return Collections.<FieldName>emptySet(); } }
/** * Get the Druid Metric Names by the logical table they should be present in. * * @param logicalTable Logical table for which to get the DruidMetricNames * * @return the Druid metric names for that logical table */ public static Set<FieldName> getByLogicalTable(TestLogicalTableName logicalTable) { switch (logicalTable) { case SHAPES: return Utils.asLinkedHashSet(HEIGHT, WIDTH, DEPTH, USERS); case PETS: return Utils.asLinkedHashSet(LIMBS); case MONTHLY: case HOURLY: return Utils.asLinkedHashSet(LIMBS); } return Collections.<FieldName>emptySet(); } }
/** * Get the set of ApiDimensionNames for the logical table, by name. * * @param logicalTable Name of the logical table * * @return the set of it's dimension names */ public static Set<TestApiDimensionName> getByLogicalTable(TestLogicalTableName logicalTable) { switch (logicalTable) { case SHAPES: return Utils.asLinkedHashSet(SIZE, SHAPE, COLOR, OTHER, MODEL); case PETS: return Utils.asLinkedHashSet(SPECIES, BREED, SEX); case MONTHLY: case HOURLY: case HOURLY_MONTHLY: return Utils.asLinkedHashSet(OTHER); } return Collections.<TestApiDimensionName>emptySet(); } }
/** * Get the set of ApiDimensionNames for the logical table, by name. * * @param logicalTable Name of the logical table * * @return the set of it's dimension names */ public static Set<TestApiDimensionName> getByLogicalTable(TestLogicalTableName logicalTable) { switch (logicalTable) { case SHAPES: return Utils.asLinkedHashSet(SIZE, SHAPE, COLOR, OTHER, MODEL); case PETS: return Utils.asLinkedHashSet(SPECIES, BREED, SEX); case MONTHLY: case HOURLY: case HOURLY_MONTHLY: return Utils.asLinkedHashSet(OTHER); } return Collections.<TestApiDimensionName>emptySet(); } }
switch (logicalTable) { case PETS: return Utils.asLinkedHashSet(A_ROW_NUM, A_LIMBS, A_DAY_AVG_LIMBS); case SHAPES: return Utils.asLinkedHashSet( A_HEIGHT, A_WIDTH, ); case MONTHLY: return Utils.asLinkedHashSet(A_LIMBS, A_DAY_AVG_LIMBS); case HOURLY: return Utils.asLinkedHashSet(A_LIMBS); case HOURLY_MONTHLY: return Utils.asLinkedHashSet(A_LIMBS, A_DAY_AVG_LIMBS);
switch (logicalTable) { case PETS: return Utils.asLinkedHashSet(A_ROW_NUM, A_LIMBS, A_DAY_AVG_LIMBS); case SHAPES: return Utils.asLinkedHashSet( A_HEIGHT, A_WIDTH, ); case MONTHLY: return Utils.asLinkedHashSet(A_LIMBS, A_DAY_AVG_LIMBS); case HOURLY: return Utils.asLinkedHashSet(A_LIMBS); case HOURLY_MONTHLY: return Utils.asLinkedHashSet(A_LIMBS, A_DAY_AVG_LIMBS);
@Override public void query(Dimension dimension, DataSource dataSource) { SuccessCallback successCallback = buildSuccessCallback(dimension); SqlPhysicalTable sqlTable = (SqlPhysicalTable) dataSource.getPhysicalTable().getSourceTable(); GroupByQuery groupByQuery = new GroupByQuery( dataSource, AllGranularity.INSTANCE, Collections.singletonList(dimension), null, null, Collections.emptyList(), Collections.emptyList(), Collections.singletonList(INTERVAL), new LimitSpec(Utils.asLinkedHashSet(), OptionalInt.of(ROW_LIMIT)) ); sqlBackedClient.executeQuery(groupByQuery, successCallback, failureCallback); }
/** * Build the monthly table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the monthly table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildMonthlyTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( MONTHLY, MONTH.buildZonedTimeGrain(DateTimeZone.UTC), new LinkedHashSet<>(Arrays.asList(TestDruidMetricName.values())), testDimensions.getDimensionConfigurationsByApiName(OTHER) ) ); }
/** * Build the hourly table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the hourly table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildHourlyTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( HOURLY, HOUR.buildZonedTimeGrain(DateTimeZone.UTC), new LinkedHashSet<>(Arrays.asList(TestDruidMetricName.values())), testDimensions.getDimensionConfigurationsByApiName(OTHER) ) ); }
/** * Build the hourly table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the hourly table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildHourlyTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( HOURLY, HOUR.buildZonedTimeGrain(DateTimeZone.UTC), new LinkedHashSet<>(Arrays.asList(TestDruidMetricName.values())), testDimensions.getDimensionConfigurationsByApiName(OTHER) ) ); }
/** * Build the monthly table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the monthly table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildMonthlyTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( MONTHLY, MONTH.buildZonedTimeGrain(DateTimeZone.UTC), new LinkedHashSet<>(Arrays.asList(TestDruidMetricName.values())), testDimensions.getDimensionConfigurationsByApiName(OTHER) ) ); }
loadLogicalTablesWithGranularities( hourlyGroup, Utils.asLinkedHashSet(HOUR), tableDictionary, hourlyGroup.keySet().stream().collect(Collectors.toMap(Function.identity(), metricDictionary::getScope)) loadLogicalTablesWithGranularities( hourlyMonthlyGroup, Utils.asLinkedHashSet(HOUR, MONTH), tableDictionary, hourlyMonthlyGroup.keySet().stream()
loadLogicalTablesWithGranularities( hourlyGroup, Utils.asLinkedHashSet(HOUR), tableDictionary, hourlyGroup.keySet().stream().collect(Collectors.toMap(Function.identity(), metricDictionary::getScope)) loadLogicalTablesWithGranularities( hourlyMonthlyGroup, Utils.asLinkedHashSet(HOUR, MONTH), tableDictionary, hourlyMonthlyGroup.keySet().stream()
tableDimensions.put(SHAPES, Utils.asLinkedHashSet(SIZE, SHAPE, COLOR, OTHER)); tableDimensions.put(PETS, Utils.asLinkedHashSet(BREED, SPECIES, SEX));
/** * Build the pet table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the pet table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildPetTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( ALL_PETS, DAY.buildZonedTimeGrain(DateTimeZone.UTC), metricNames, testDimensions.getDimensionConfigurationsByApiName(BREED, SEX, SPECIES) ) ); }
/** * Build the pet table definitions. * * @param testDimensions Dimensions to build the tables with * @param metricNames The field name of metrics to build with * * @return the pet table definitions */ public static LinkedHashSet<PhysicalTableDefinition> buildPetTableDefinitions( TestDimensions testDimensions, Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( ALL_PETS, DAY.buildZonedTimeGrain(DateTimeZone.UTC), metricNames, testDimensions.getDimensionConfigurationsByApiName(BREED, SEX, SPECIES) ) ); }
tableDimensions.put(SHAPES, Utils.asLinkedHashSet(SIZE, SHAPE, COLOR, OTHER)); tableDimensions.put(PETS, Utils.asLinkedHashSet(BREED, SPECIES, SEX));
Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( ALL_SHAPES,
Set<FieldName> metricNames ) { return Utils.asLinkedHashSet( new ConcretePhysicalTableDefinition( ALL_SHAPES,