Skip to content

Commit

Permalink
Move ApproxPercentile intermediate type index to header file (#11224)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #11224

Moved the enum `IntermediateTypeChildIndex` of ApproxPercentileAggregate function to header file.

Reviewed By: Yuhta

Differential Revision: D64121943

fbshipit-source-id: add1c40d0fc72c9838e0790ed0d480c45ccf693d
  • Loading branch information
metaduc authored and facebook-github-bot committed Oct 23, 2024
1 parent 02235dd commit 14a74eb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "velox/functions/prestosql/aggregates/ApproxPercentileAggregate.h"
#include "velox/common/base/IOUtils.h"
#include "velox/common/base/Macros.h"
#include "velox/common/base/RandomUtil.h"
Expand Down Expand Up @@ -169,18 +170,6 @@ struct KllSketchAccumulator {
largeCountValues_;
};

enum IntermediateTypeChildIndex {
kPercentiles = 0,
kPercentilesIsArray = 1,
kAccuracy = 2,
kK = 3,
kN = 4,
kMinValue = 5,
kMaxValue = 6,
kItems = 7,
kLevels = 8,
};

void checkWeight(int64_t weight) {
constexpr int64_t kMaxWeight = (1ll << 60) - 1;
VELOX_USER_CHECK(
Expand Down
33 changes: 33 additions & 0 deletions velox/functions/prestosql/aggregates/ApproxPercentileAggregate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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.
*/

#pragma once

namespace facebook::velox::aggregate::prestosql {

enum ApproxPercentileIntermediateTypeChildIndex {
kPercentiles = 0,
kPercentilesIsArray = 1,
kAccuracy = 2,
kK = 3,
kN = 4,
kMinValue = 5,
kMaxValue = 6,
kItems = 7,
kLevels = 8,
};

} // namespace facebook::velox::aggregate::prestosql

0 comments on commit 14a74eb

Please sign in to comment.