Coverage Report

Created: 2024-11-21 15:53

/root/doris/be/src/vec/functions/round.cpp
Line
Count
Source
1
// Licensed to the Apache Software Foundation (ASF) under one
2
// or more contributor license agreements.  See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership.  The ASF licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License.  You may obtain a copy of the License at
8
//
9
//   http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied.  See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
#include "round.h"
19
20
#include "vec/functions/simple_function_factory.h"
21
22
namespace doris::vectorized {
23
24
// We split round funcs from register_function_math() in math.cpp to here,
25
// so that to speed up compile time and make code more readable.
26
1
void register_function_round(SimpleFunctionFactory& factory) {
27
1
#define REGISTER_ROUND_FUNCTIONS(IMPL)                                                           \
28
4
    factory.register_function<                                                                   \
29
4
            FunctionRounding<IMPL<TruncateName>, RoundingMode::Trunc, TieBreakingMode::Auto>>(); \
30
4
    factory.register_function<                                                                   \
31
4
            FunctionRounding<IMPL<FloorName>, RoundingMode::Floor, TieBreakingMode::Auto>>();    \
32
4
    factory.register_function<                                                                   \
33
4
            FunctionRounding<IMPL<RoundName>, RoundingMode::Round, TieBreakingMode::Auto>>();    \
34
4
    factory.register_function<                                                                   \
35
4
            FunctionRounding<IMPL<CeilName>, RoundingMode::Ceil, TieBreakingMode::Auto>>();      \
36
4
    factory.register_function<FunctionRounding<IMPL<RoundBankersName>, RoundingMode::Round,      \
37
4
                                               TieBreakingMode::Bankers>>();
38
39
1
    REGISTER_ROUND_FUNCTIONS(DecimalRoundOneImpl)
40
1
    REGISTER_ROUND_FUNCTIONS(DecimalRoundTwoImpl)
41
1
    REGISTER_ROUND_FUNCTIONS(DoubleRoundOneImpl)
42
1
    REGISTER_ROUND_FUNCTIONS(DoubleRoundTwoImpl)
43
44
1
    factory.register_alias("ceil", "dceil");
45
1
    factory.register_alias("ceil", "ceiling");
46
1
    factory.register_alias("floor", "dfloor");
47
1
    factory.register_alias("round", "dround");
48
1
}
49
50
} // namespace doris::vectorized