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

WIP - Remodel aggregate plans #2597

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hatyo
Copy link
Contributor

@hatyo hatyo commented Mar 20, 2024

No description provided.

@hatyo hatyo added the DO NOT MERGE do not merge label Mar 20, 2024
@hatyo hatyo requested a review from normen662 March 20, 2024 13:35
@foundationdb-ci
Copy link
Contributor

Result of fdb-record-layer-pr on Linux CentOS 7

  • Commit ID: a632619
  • Duration 0:41:23
  • Result: ❌ FAILED
  • Error: Error while executing command: ./gradlew --no-daemon --console=plain -b ./build.gradle build destructiveTest -PcoreNotStrict -PreleaseBuild=false -PpublishBuild=false -PspotbugsEnableHtmlReport. Reason: exit status 1
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

please remove

@Nullable
private final FieldValue groupingValue;
@Nonnull
private final List<Value> groupingValues;
Copy link
Contributor

Choose a reason for hiding this comment

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

So this being a FieldValue was wrong. But this should just be a Value which is a RCV. I mean the result of a SelectExpression is also not a list of Values. This is complicating the expression as you have a bonafide way of expressing a list of expressions by using an RCV, why using the other representation.


@Nonnull
private final AggregateValue aggregateValue;
private final List<AggregateValue> aggregateValues;
Copy link
Contributor

Choose a reason for hiding this comment

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

Some thing here. An RCV is an AggregateValue so it can compose the actual aggregates.

* @param inner The underlying source of tuples to be grouped.
*/
public GroupByExpression(@Nonnull final AggregateValue aggregateValue,
@Nullable final FieldValue groupingValue,
public GroupByExpression(@Nonnull final List<AggregateValue> aggregateValues,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not make another factory method that just takes two lists and than fabricates RCVs both on top of grouping keys as well as aggregate values.

@@ -91,7 +89,7 @@ public void onMatch(@Nonnull final CascadesRuleCall call) {

for (final var planPartition : planPartitions) {
final var providedOrdering = planPartition.getAttributeValue(OrderingProperty.ORDERING);
if (requiredOrderingKeyValues == null || providedOrdering.satisfiesGroupingValues(requiredOrderingKeyValues)) {
if (providedOrdering.satisfiesGroupingValues(requiredOrderingKeyValues)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This may or may not work.

final var rebasedAggregatedValue = groupByExpression.getAggregateValue().rebase(aliasMap);
final var rebasedGroupingValue = groupByExpression.getGroupingValue() == null ? null : groupByExpression.getGroupingValue().rebase(aliasMap);
return RecordQueryStreamingAggregationPlan.ofNested(
final var rebasedAggregatedValue = RecordConstructorValue.ofUnnamed(groupByExpression.getAggregateValues()).rebase(aliasMap);
Copy link
Contributor

Choose a reason for hiding this comment

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

and now we need to make them RCVs again?

@@ -256,7 +256,7 @@ public static BindingMatcher<GroupByExpression> groupByExpression(@Nonnull final
AllOfMatcher.matchingAllOf(GroupByExpression.class,
ImmutableList.of(
typedWithDownstream(GroupByExpression.class,
Extractor.of(GroupByExpression::getAggregateValue, name -> "aggregation(" + name + ")"),
Extractor.of(GroupByExpression::getAggregateValues, name -> "aggregation(" + name + ")"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this not used? If it is and the caller is not adapted I would imagine things not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DO NOT MERGE do not merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants