Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable SortProjectTransposeRule #15002

Merged
merged 14 commits into from
Sep 29, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -824,8 +824,8 @@ public void testtHllSketchPostAggsPostSort()
.postAggregators(
ImmutableList.of(
new HllSketchToEstimatePostAggregator("p1", new FieldAccessPostAggregator("p0", "a0"), false),
new HllSketchToEstimatePostAggregator("s1", new FieldAccessPostAggregator("s0", "a0"), false),
new HllSketchToStringPostAggregator("s3", new FieldAccessPostAggregator("s2", "a0"))
new HllSketchToEstimatePostAggregator("_p1", new FieldAccessPostAggregator("_p0", "a0"), false),
new HllSketchToStringPostAggregator("_p3", new FieldAccessPostAggregator("_p2", "a0"))
)
)
.context(QUERY_CONTEXT_DEFAULT)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,13 @@ public void testDoublesSketchPostAggsPostSort()
0.5
),
new DoublesSketchToQuantilePostAggregator(
"s1",
new FieldAccessPostAggregator("s0", "a0:agg"),
"_p1",
new FieldAccessPostAggregator("_p0", "a0:agg"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did these change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are 2 callsites to create the postaggregates - one of them uses p and the other s as prefix; I was getting almost 100% matching plans with column alias mistmatches because of the different prefixes - so I've changed that; as the main importance of them is to have them unique.

I've today tried to remove the change of that prefix thing - and I think that change might not be needed in this patch.

I've update the PR

0.5
),
new DoublesSketchToQuantilePostAggregator(
"s3",
new FieldAccessPostAggregator("s2", "a0:agg"),
"_p3",
new FieldAccessPostAggregator("_p2", "a0:agg"),
0.9800000190734863
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -747,8 +747,8 @@ public void testThetaSketchPostAggsPostSort()
null
),
new SketchEstimatePostAggregator(
"s1",
new FieldAccessPostAggregator("s0", "a0"),
"_p1",
new FieldAccessPostAggregator("_p0", "a0"),
null
)
)
Expand Down Expand Up @@ -803,8 +803,8 @@ public void testThetaSketchPostAggsPostSortFinalizeOuterSketches()
null
),
new SketchEstimatePostAggregator(
"s1",
new FieldAccessPostAggregator("s0", "a0"),
"_p1",
new FieldAccessPostAggregator("_p0", "a0"),
null
)
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public class CalciteRulesManager
CoreRules.FILTER_VALUES_MERGE,
CoreRules.PROJECT_FILTER_VALUES_MERGE,
CoreRules.PROJECT_VALUES_MERGE,
CoreRules.SORT_PROJECT_TRANSPOSE,
CoreRules.AGGREGATE_VALUES
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ private static Sorting computeSorting(

projection = Projection.preAggregation(sortProject, plannerContext, rowSignature, virtualColumnRegistry);
} else {
projection = Projection.postAggregation(sortProject, plannerContext, rowSignature, "s");
projection = Projection.postAggregation(sortProject, plannerContext, rowSignature, "p");
}

return Sorting.create(orderBys, offsetLimit, projection);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2206,7 +2206,7 @@ public void testArrayAggGroupByArrayAggFromSubquery()
.intervals(querySegmentSpec(Filtration.eternity()))
.granularity(Granularities.ALL)
.context(QUERY_CONTEXT_NO_STRINGIFY_ARRAY)
.postAggregators(new ExpressionPostAggregator("s0", "1", null, ExprMacroTable.nil()))
.postAggregators(new ExpressionPostAggregator("p0", "1", null, ExprMacroTable.nil()))
.build()
),
useDefault ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2733,7 +2733,6 @@ public void testGroupByWithSelectAndOrderByProjections()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testTopNWithSelectProjections()
{
Expand Down Expand Up @@ -11620,7 +11619,6 @@ public void testSortProjectAfterNestedGroupBy()
);
}

@DecoupledIgnore(mode = Modes.CANNOT_CONVERT)
@Test
public void testPostAggWithTimeseries()
{
Expand Down Expand Up @@ -11664,7 +11662,6 @@ public void testPostAggWithTimeseries()
);
}

@DecoupledIgnore(mode = Modes.PLAN_MISMATCH)
@Test
public void testPostAggWithTopN()
{
Expand Down