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

Test side-effect-free of Aggregate::extractXxx #8399

Closed
wants to merge 1 commit into from

Conversation

kagamiori
Copy link
Contributor

Summary:
Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

Differential Revision: D52755566

Copy link

netlify bot commented Jan 17, 2024

Deploy Preview for meta-velox canceled.

Name Link
🔨 Latest commit 8b5b401
🔍 Latest deploy log https://app.netlify.com/sites/meta-velox/deploys/65aea479601b5c0008221567

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 17, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 17, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 17, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 17, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 17, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

Differential Revision: D52755566
Copy link
Contributor

@mbasmanova mbasmanova left a comment

Choose a reason for hiding this comment

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

@kagamiori Thanks. It would be nice to mention that min/max/min_by/max_by are currently having side effects and therefore excluded from testing.

@@ -208,6 +208,8 @@ class Aggregate {
// 'result' and its parts are expected to be singly referenced. If
// other threads or operators hold references that they would use
// after 'result' has been updated by this, effects will be unpredictable.
// This method should be side-effect free, i.e., calling this method
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should be side-effect free -> should not have side effects.

@@ -208,6 +208,8 @@ class Aggregate {
// 'result' and its parts are expected to be singly referenced. If
// other threads or operators hold references that they would use
// after 'result' has been updated by this, effects will be unpredictable.
// This method should be side-effect free, i.e., calling this method
// doesn't change the content of the accumnulators.
Copy link
Contributor

Choose a reason for hiding this comment

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

accumnulators -> accumulators

It would be nice to explain why we have this requirement.

auto constant = core::TypedExprs::asConstant(arg);
columns.push_back(constant->toConstantVector(pool));
}
if (auto lambda = dynamic_cast<const core::LambdaTypedExpr*>(arg.get())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we not have core::TypedExprs::asLambda? Let's add.

@@ -265,6 +272,15 @@ class AggregationTestBase : public exec::test::OperatorTestBase {
vector_size_t rawInput2Size,
const std::unordered_map<std::string, std::string>& config = {});

// Test to ensure that when extractValues() or extractAccumulators() is called
// twice on the same accumulator, the extracted results are the same. This
// ensure that extractValues() and extractAccumulators() are free of side
Copy link
Contributor

Choose a reason for hiding this comment

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

ensure -> ensures

func->extractValues(groups.data(), 1, &result2);
velox::test::assertEqualVectors(result1, result2);

// Destroy accumulators to avoid memory leak.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to do this if there is an exception?

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are 
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are 
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are 
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects, so their tests are
excluded from the added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal 
inputs have undefined values in intermediate results. So they are excluded from the 
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 19, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal 
inputs have undefined values in intermediate results. So they are excluded from the 
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 22, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 22, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 22, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D52755566

kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 22, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
kagamiori added a commit to kagamiori/velox that referenced this pull request Jan 22, 2024
Summary:

Add a test in testAggregations to check that Aggregate::extractAccumulators and
Aggregate::extractValues don't have side effects of changing the accumulators.

min, max, min_by, and max_by currently have side effects. avg and sum for decimal
inputs have undefined values in intermediate results. So they are excluded from the
added testing.

Reviewed By: mbasmanova

Differential Revision: D52755566
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in ce18fe4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants