forked from facebookincubator/velox
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split MinMaxByAggregates.cpp for faster compilation times (facebookin…
…cubator#11098) Summary: Pull Request resolved: facebookincubator#11098 Splitting the .cpp into two compilation unitst (one for min one for max) so that compilation can be parallelized. In my development environment, recompilations of this unit went from 1m50s to about 40s. Reviewed By: xiaoxmeng Differential Revision: D63433609 fbshipit-source-id: 5402a280dfa3f5e65ffa10c49102579820e1eb4c
- Loading branch information
1 parent
afa43a7
commit 050839c
Showing
5 changed files
with
118 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "velox/functions/prestosql/aggregates/AggregateNames.h" | ||
#include "velox/functions/prestosql/aggregates/MinMaxByAggregateBase.h" | ||
|
||
namespace facebook::velox::aggregate::prestosql { | ||
|
||
template <typename V, typename C> | ||
class MaxByNAggregate : public MinMaxByNAggregate<V, C, Greater<V, C>> { | ||
public: | ||
explicit MaxByNAggregate(TypePtr resultType) | ||
: MinMaxByNAggregate<V, C, Greater<V, C>>(resultType) {} | ||
}; | ||
|
||
template <typename C> | ||
class MaxByNAggregate<ComplexType, C> | ||
: public MinMaxByNAggregate< | ||
ComplexType, | ||
C, | ||
Greater<HashStringAllocator::Position, C>> { | ||
public: | ||
explicit MaxByNAggregate(TypePtr resultType) | ||
: MinMaxByNAggregate< | ||
ComplexType, | ||
C, | ||
Greater<HashStringAllocator::Position, C>>(resultType) {} | ||
}; | ||
|
||
void registerMaxByAggregates( | ||
const std::string& prefix, | ||
bool withCompanionFunctions, | ||
bool overwrite) { | ||
registerMinMaxBy< | ||
functions::aggregate::MinMaxByAggregateBase, | ||
true, | ||
MaxByNAggregate>(prefix + kMaxBy, withCompanionFunctions, overwrite); | ||
} | ||
|
||
} // namespace facebook::velox::aggregate::prestosql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "velox/functions/prestosql/aggregates/AggregateNames.h" | ||
#include "velox/functions/prestosql/aggregates/MinMaxByAggregateBase.h" | ||
|
||
namespace facebook::velox::aggregate::prestosql { | ||
|
||
template <typename V, typename C> | ||
class MinByNAggregate : public MinMaxByNAggregate<V, C, Less<V, C>> { | ||
public: | ||
explicit MinByNAggregate(TypePtr resultType) | ||
: MinMaxByNAggregate<V, C, Less<V, C>>(resultType) {} | ||
}; | ||
|
||
template <typename C> | ||
class MinByNAggregate<ComplexType, C> | ||
: public MinMaxByNAggregate< | ||
ComplexType, | ||
C, | ||
Less<HashStringAllocator::Position, C>> { | ||
public: | ||
explicit MinByNAggregate(TypePtr resultType) | ||
: MinMaxByNAggregate< | ||
ComplexType, | ||
C, | ||
Less<HashStringAllocator::Position, C>>(resultType) {} | ||
}; | ||
|
||
void registerMinByAggregates( | ||
const std::string& prefix, | ||
bool withCompanionFunctions, | ||
bool overwrite) { | ||
registerMinMaxBy< | ||
functions::aggregate::MinMaxByAggregateBase, | ||
false, | ||
MinByNAggregate>(prefix + kMinBy, withCompanionFunctions, overwrite); | ||
} | ||
|
||
} // namespace facebook::velox::aggregate::prestosql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters