Source:
public void testSubqueryWithExtractionFnInOuterQuery() { QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec( Collections.singletonList(Intervals.utc(1500000000000L, 1600000000000L)) ); GroupByQuery query = GroupByQuery .builder() .setDataSource("blah") .setDimensions( new DefaultDimensionSpec("dimA", "dimA"), new DefaultDimensionSpec("dimB", "dimB") ) .setAggregatorSpecs( new LongSumAggregatorFactory("metASum", "metA"), new LongSumAggregatorFactory("metBSum", "metB") ) .setGranularity(Granularities.ALL) .setQuerySegmentSpec(intervalSpec) .build(); GroupByQuery nestedQuery = GroupByQuery .builder() .setDataSource(query) .setDimensions( new DefaultDimensionSpec("dimA", "newDimA") ) .setDimensions( new ExtractionDimensionSpec( "dimA", "extractedDimA", new RegexDimExtractionFn("^(p)", true, "replacement") ) ) .setAggregatorSpecs( new LongSumAggregatorFactory("finalSum", "metASum") ) .setContext( ImmutableMap.of( GroupByQueryConfig.CTX_KEY_FORCE_PUSH_DOWN_NESTED_QUERY, true ) ) .setGranularity(Granularities.ALL) .setQuerySegmentSpec(intervalSpec) .build(); Row expectedRow0 = GroupByQueryRunnerTestHelper.createExpectedRow( "2017-07-14T02:40:00.000Z", "finalSum", 4000L, "extractedDimA", "p" ); Row expectedRow1 = GroupByQueryRunnerTestHelper.createExpectedRow( "2017-07-14T02:40:00.000Z", "finalSum", 4000L, "extractedDimA", "replacement" ); Sequence<Row> queryResult = runNestedQueryWithForcePushDown(nestedQuery, Maps.newHashMap()); List<Row> results = queryResult.toList(); Assert.assertEquals(2, results.size()); Assert.assertEquals(expectedRow0, results.get(0)); Assert.assertEquals(expectedRow1, results.get(1)); }

Target:
public void testSubqueryWithExtractionFnInOuterQuery() { QuerySegmentSpec intervalSpec = new MultipleIntervalSegmentSpec( Collections.singletonList(Intervals.utc(1500000000000L, 1600000000000L)) ); GroupByQuery query = GroupByQuery .builder() .setDataSource("blah") .setDimensions(new DefaultDimensionSpec("dimA", "dimA"), new DefaultDimensionSpec("dimB", "dimB")) .setAggregatorSpecs( new LongSumAggregatorFactory("metASum", "metA"), new LongSumAggregatorFactory("metBSum", "metB") ) .setGranularity(Granularities.ALL) .setQuerySegmentSpec(intervalSpec) .build(); GroupByQuery nestedQuery = GroupByQuery .builder() .setDataSource(query) .setDimensions(new ExtractionDimensionSpec("dimA", "extractedDimA", new RegexDimExtractionFn("^(p)", true, "replacement" ))) .setAggregatorSpecs(new LongSumAggregatorFactory("finalSum", "metASum")) .setContext( ImmutableMap.of( GroupByQueryConfig.CTX_KEY_FORCE_PUSH_DOWN_NESTED_QUERY, true ) ) .setGranularity(Granularities.ALL) .setQuerySegmentSpec(intervalSpec) .build(); Row expectedRow0 = GroupByQueryRunnerTestHelper.createExpectedRow( "2017-07-14T02:40:00.000Z", "finalSum", 4000L, "extractedDimA", "p" ); Row expectedRow1 = GroupByQueryRunnerTestHelper.createExpectedRow( "2017-07-14T02:40:00.000Z", "finalSum", 4000L, "extractedDimA", "replacement" ); Sequence<Row> queryResult = runNestedQueryWithForcePushDown(nestedQuery, Maps.newHashMap()); List<Row> results = queryResult.toList(); Assert.assertEquals(2, results.size()); Assert.assertEquals(expectedRow0, results.get(0)); Assert.assertEquals(expectedRow1, results.get(1)); }