-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
✅ Deploy Preview for meta-velox canceled.
|
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. Differential Revision: D52755566
fb36050
to
28a8035
Compare
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. Differential Revision: D52755566
28a8035
to
6577c67
Compare
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
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. Differential Revision: D52755566
There was a problem hiding this 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.
velox/exec/Aggregate.h
Outdated
@@ -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 |
There was a problem hiding this comment.
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.
velox/exec/Aggregate.h
Outdated
@@ -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. |
There was a problem hiding this comment.
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())) { |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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?
6577c67
to
33aa0ed
Compare
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
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, so their tests are excluded from the added testing. Reviewed By: mbasmanova 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, so their tests are excluded from the added testing. Reviewed By: mbasmanova 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, so their tests are excluded from the added testing. Reviewed By: mbasmanova Differential Revision: D52755566
33aa0ed
to
8414713
Compare
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, so their tests are excluded from the added testing. Reviewed By: mbasmanova Differential Revision: D52755566
8414713
to
a6590c1
Compare
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
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, so their tests are excluded from the added testing. Reviewed By: mbasmanova 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, so their tests are excluded from the added testing. Reviewed By: mbasmanova 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
a6590c1
to
26f805e
Compare
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
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
26f805e
to
4616e3b
Compare
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
4616e3b
to
ae3b332
Compare
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
ae3b332
to
843026b
Compare
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
843026b
to
8b5b401
Compare
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
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
This pull request has been merged in ce18fe4. |
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