[Chore](build) enchancement for backend build time usage (#18344)

This commit is contained in:
Pxl
2023-04-06 11:13:21 +08:00
committed by GitHub
parent 4ca0c0face
commit 76d76f672c
21 changed files with 193 additions and 414 deletions

View File

@ -76,6 +76,10 @@ else()
endif()
option(USE_JEMALLOC "Use jemalloc" ON)
if (DISPLAY_BUILD_TIME)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "time -f 'TimeUsage: real=%es, user=%Us, sys=%Ss'")
endif()
message(STATUS "GLIBC_COMPATIBILITY is ${GLIBC_COMPATIBILITY}")
message(STATUS "USE_LIBCPP is ${USE_LIBCPP}")
message(STATUS "USE_MEM_TRACKER is ${USE_MEM_TRACKER}")
@ -132,7 +136,7 @@ set(Boost_DEBUG FALSE)
set(Boost_USE_MULTITHREADED ON)
set(Boost_ROOT ${THIRDPARTY_DIR})
set(Boost_NO_BOOST_CMAKE OFF)
set(BOOST_VERSION "1.73.0")
set(BOOST_VERSION "1.81.0")
if (NOT APPLE)
find_package(Boost ${BOOST_VERSION} REQUIRED COMPONENTS system date_time)
@ -935,7 +939,7 @@ endif ()
get_directory_property(COMPILER_FLAGS COMPILE_OPTIONS)
get_directory_property(COMPILER_DEFINES COMPILE_DEFINITIONS)
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}")
message(STATUS "Compiler: ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}")
message(STATUS "CXX Standard: ${CMAKE_CXX_STANDARD}")
message(STATUS "C Standard: ${CMAKE_C_STANDARD}")
message(STATUS "CXX Flags: ${CMAKE_CXX_FLAGS}")

View File

@ -30,7 +30,8 @@ set(VEC_FILES
aggregate_functions/aggregate_function_sum.cpp
aggregate_functions/aggregate_function_sort.cpp
aggregate_functions/aggregate_function_min_max.cpp
aggregate_functions/aggregate_function_min_max_by.cpp
aggregate_functions/aggregate_function_min_by.cpp
aggregate_functions/aggregate_function_max_by.cpp
aggregate_functions/aggregate_function_uniq.cpp
aggregate_functions/aggregate_function_hll_union_agg.cpp
aggregate_functions/aggregate_function_bit.cpp

View File

@ -0,0 +1,29 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 "vec/aggregate_functions/aggregate_function_min_max_by.h"
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
namespace doris::vectorized {
void register_aggregate_function_max_by(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both(
"max_by", create_aggregate_function_min_max_by<AggregateFunctionsMinMaxBy,
AggregateFunctionMaxByData>);
}
} // namespace doris::vectorized

View File

@ -0,0 +1,29 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 "vec/aggregate_functions/aggregate_function_min_max_by.h"
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
namespace doris::vectorized {
void register_aggregate_function_min_by(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both(
"min_by", create_aggregate_function_min_max_by<AggregateFunctionsMinMaxBy,
AggregateFunctionMinByData>);
}
} // namespace doris::vectorized

View File

@ -447,12 +447,10 @@ struct AggregateFunctionMaxData : public Data {
using Self = AggregateFunctionMaxData;
using Data::IsFixedLength;
bool change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
return this->change_if_greater(column, row_num, arena);
}
bool change_if_better(const Self& to, Arena* arena) {
return this->change_if_greater(to, arena);
void change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
this->change_if_greater(column, row_num, arena);
}
void change_if_better(const Self& to, Arena* arena) { this->change_if_greater(to, arena); }
static const char* name() { return "max"; }
};
@ -462,10 +460,10 @@ struct AggregateFunctionMinData : Data {
using Self = AggregateFunctionMinData;
using Data::IsFixedLength;
bool change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
return this->change_if_less(column, row_num, arena);
void change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
this->change_if_less(column, row_num, arena);
}
bool change_if_better(const Self& to, Arena* arena) { return this->change_if_less(to, arena); }
void change_if_better(const Self& to, Arena* arena) { this->change_if_less(to, arena); }
static const char* name() { return "min"; }
};
@ -475,12 +473,10 @@ struct AggregateFunctionAnyData : Data {
using Self = AggregateFunctionAnyData;
using Data::IsFixedLength;
bool change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
return this->change_first_time(column, row_num, arena);
}
bool change_if_better(const Self& to, Arena* arena) {
return this->change_first_time(to, arena);
void change_if_better(const IColumn& column, size_t row_num, Arena* arena) {
this->change_first_time(column, row_num, arena);
}
void change_if_better(const Self& to, Arena* arena) { this->change_first_time(to, arena); }
static const char* name() { return "any"; }
};

View File

@ -1,131 +0,0 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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 "vec/aggregate_functions/aggregate_function_min_max_by.h"
#include "vec/aggregate_functions/aggregate_function_min_max.h"
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
#include "vec/aggregate_functions/factory_helpers.h"
#include "vec/aggregate_functions/helpers.h"
#include "vec/core/types.h"
namespace doris::vectorized {
/// min_by, max_by
template <template <typename> class AggregateFunctionTemplate,
template <typename, typename> class Data, typename VT>
AggregateFunctionPtr create_aggregate_function_min_max_by_impl(const DataTypes& argument_types,
const bool result_is_nullable) {
WhichDataType which(remove_nullable(argument_types[1]));
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return creator_without_type::create< \
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<TYPE>>>>( \
argument_types, result_is_nullable);
FOR_NUMERIC_TYPES(DISPATCH)
#undef DISPATCH
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return creator_without_type::create< \
AggregateFunctionTemplate<Data<VT, SingleValueDataDecimal<TYPE>>>>( \
argument_types, result_is_nullable);
FOR_DECIMAL_TYPES(DISPATCH)
#undef DISPATCH
if (which.idx == TypeIndex::String) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataString>>>(argument_types,
result_is_nullable);
}
if (which.idx == TypeIndex::DateTime || which.idx == TypeIndex::Date) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<Int64>>>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateV2) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<UInt32>>>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateTimeV2) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<UInt64>>>>(
argument_types, result_is_nullable);
}
return nullptr;
}
/// min_by, max_by
template <template <typename> class AggregateFunctionTemplate,
template <typename, typename> class Data>
AggregateFunctionPtr create_aggregate_function_min_max_by(const String& name,
const DataTypes& argument_types,
const bool result_is_nullable) {
assert_binary(name, argument_types);
WhichDataType which(remove_nullable(argument_types[0]));
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data, \
SingleValueDataFixed<TYPE>>( \
argument_types, result_is_nullable);
FOR_NUMERIC_TYPES(DISPATCH)
#undef DISPATCH
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data, \
SingleValueDataDecimal<TYPE>>( \
argument_types, result_is_nullable);
FOR_DECIMAL_TYPES(DISPATCH)
#undef DISPATCH
if (which.idx == TypeIndex::String) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataString>(argument_types,
result_is_nullable);
}
if (which.idx == TypeIndex::DateTime || which.idx == TypeIndex::Date) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<Int64>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateV2) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<UInt32>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateTimeV2) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<UInt64>>(
argument_types, result_is_nullable);
}
return nullptr;
}
void register_aggregate_function_min_max_by(AggregateFunctionSimpleFactory& factory) {
factory.register_function_both(
"max_by", create_aggregate_function_min_max_by<AggregateFunctionsMinMaxBy,
AggregateFunctionMaxByData>);
factory.register_function_both(
"min_by", create_aggregate_function_min_max_by<AggregateFunctionsMinMaxBy,
AggregateFunctionMinByData>);
}
} // namespace doris::vectorized

View File

@ -19,6 +19,8 @@
#include "common/logging.h"
#include "vec/aggregate_functions/aggregate_function.h"
#include "vec/aggregate_functions/aggregate_function_min_max.h"
#include "vec/aggregate_functions/helpers.h"
#include "vec/columns/column_decimal.h"
#include "vec/columns/column_vector.h"
#include "vec/common/assert_cast.h"
@ -52,21 +54,17 @@ public:
template <typename VT, typename KT>
struct AggregateFunctionMaxByData : public AggregateFunctionMinMaxByBaseData<VT, KT> {
using Self = AggregateFunctionMaxByData;
bool change_if_better(const IColumn& value_column, const IColumn& key_column, size_t row_num,
void change_if_better(const IColumn& value_column, const IColumn& key_column, size_t row_num,
Arena* arena) {
if (this->key.change_if_greater(key_column, row_num, arena)) {
this->value.change(value_column, row_num, arena);
return true;
}
return false;
}
bool change_if_better(const Self& to, Arena* arena) {
void change_if_better(const Self& to, Arena* arena) {
if (this->key.change_if_greater(to.key, arena)) {
this->value.change(to.value, arena);
return true;
}
return false;
}
static const char* name() { return "max_by"; }
@ -75,21 +73,17 @@ struct AggregateFunctionMaxByData : public AggregateFunctionMinMaxByBaseData<VT,
template <typename VT, typename KT>
struct AggregateFunctionMinByData : public AggregateFunctionMinMaxByBaseData<VT, KT> {
using Self = AggregateFunctionMinByData;
bool change_if_better(const IColumn& value_column, const IColumn& key_column, size_t row_num,
void change_if_better(const IColumn& value_column, const IColumn& key_column, size_t row_num,
Arena* arena) {
if (this->key.change_if_less(key_column, row_num, arena)) {
this->value.change(value_column, row_num, arena);
return true;
}
return false;
}
bool change_if_better(const Self& to, Arena* arena) {
void change_if_better(const Self& to, Arena* arena) {
if (this->key.change_if_less(to.key, arena)) {
this->value.change(to.value, arena);
return true;
}
return false;
}
static const char* name() { return "min_by"; }
@ -144,12 +138,94 @@ public:
}
};
AggregateFunctionPtr create_aggregate_function_max_by(const std::string& name,
const DataTypes& argument_types,
const bool result_is_nullable);
template <template <typename> class AggregateFunctionTemplate,
template <typename, typename> class Data, typename VT>
AggregateFunctionPtr create_aggregate_function_min_max_by_impl(const DataTypes& argument_types,
const bool result_is_nullable) {
WhichDataType which(remove_nullable(argument_types[1]));
AggregateFunctionPtr create_aggregate_function_min_by(const std::string& name,
const DataTypes& argument_types,
const bool result_is_nullable);
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return creator_without_type::create< \
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<TYPE>>>>( \
argument_types, result_is_nullable);
FOR_NUMERIC_TYPES(DISPATCH)
#undef DISPATCH
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return creator_without_type::create< \
AggregateFunctionTemplate<Data<VT, SingleValueDataDecimal<TYPE>>>>( \
argument_types, result_is_nullable);
FOR_DECIMAL_TYPES(DISPATCH)
#undef DISPATCH
if (which.idx == TypeIndex::String) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataString>>>(argument_types,
result_is_nullable);
}
if (which.idx == TypeIndex::DateTime || which.idx == TypeIndex::Date) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<Int64>>>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateV2) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<UInt32>>>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateTimeV2) {
return creator_without_type::create<
AggregateFunctionTemplate<Data<VT, SingleValueDataFixed<UInt64>>>>(
argument_types, result_is_nullable);
}
return nullptr;
}
template <template <typename> class AggregateFunctionTemplate,
template <typename, typename> class Data>
AggregateFunctionPtr create_aggregate_function_min_max_by(const String& name,
const DataTypes& argument_types,
const bool result_is_nullable) {
WhichDataType which(remove_nullable(argument_types[0]));
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data, \
SingleValueDataFixed<TYPE>>( \
argument_types, result_is_nullable);
FOR_NUMERIC_TYPES(DISPATCH)
#undef DISPATCH
#define DISPATCH(TYPE) \
if (which.idx == TypeIndex::TYPE) \
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data, \
SingleValueDataDecimal<TYPE>>( \
argument_types, result_is_nullable);
FOR_DECIMAL_TYPES(DISPATCH)
#undef DISPATCH
if (which.idx == TypeIndex::String) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataString>(argument_types,
result_is_nullable);
}
if (which.idx == TypeIndex::DateTime || which.idx == TypeIndex::Date) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<Int64>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateV2) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<UInt32>>(
argument_types, result_is_nullable);
}
if (which.idx == TypeIndex::DateTimeV2) {
return create_aggregate_function_min_max_by_impl<AggregateFunctionTemplate, Data,
SingleValueDataFixed<UInt64>>(
argument_types, result_is_nullable);
}
return nullptr;
}
} // namespace doris::vectorized

View File

@ -31,7 +31,8 @@ void register_aggregate_function_combinator_distinct(AggregateFunctionSimpleFact
void register_aggregate_function_sum(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_minmax(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_min_max_by(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_min_by(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_max_by(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_avg(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_count(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_HLL_union_agg(AggregateFunctionSimpleFactory& factory);
@ -63,7 +64,8 @@ AggregateFunctionSimpleFactory& AggregateFunctionSimpleFactory::instance() {
std::call_once(oc, [&]() {
register_aggregate_function_sum(instance);
register_aggregate_function_minmax(instance);
register_aggregate_function_min_max_by(instance);
register_aggregate_function_min_by(instance);
register_aggregate_function_max_by(instance);
register_aggregate_function_avg(instance);
register_aggregate_function_count(instance);
register_aggregate_function_uniq(instance);

View File

@ -89,10 +89,6 @@ using FunctionDatetimeV2SubYears =
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateTimeV2, DataTypeDateTimeV2) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateTimeV2, DataTypeDateV2) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateV2, DataTypeDateTimeV2) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateTimeV2, DataTypeDateTime) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateTime, DataTypeDateTimeV2) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateTime, DataTypeDateV2) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateV2, DataTypeDateTime) \
FUNCTION_DATEV2_WITH_TWO_ARGS(NAME, IMPL, DataTypeDateV2, DataTypeDateV2)
ALL_FUNCTION_DATEV2_WITH_TWO_ARGS(FunctionDatetimeV2DateDiff, DateDiffImpl)
@ -156,11 +152,7 @@ void register_function_date_time_computation_v2(SimpleFunctionFactory& factory)
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateTimeV2, DataTypeDateTimeV2) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateTimeV2, DataTypeDateV2) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateV2, DataTypeDateTimeV2) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateTimeV2, DataTypeDateTime) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateV2, DataTypeDateTime) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateV2, DataTypeDateV2) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateTime, DataTypeDateV2) \
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateTime, DataTypeDateTimeV2)
REGISTER_DATEV2_FUNCTIONS_WITH_TWO_ARGS(NAME, DataTypeDateV2, DataTypeDateV2)
REGISTER_ALL_DATEV2_FUNCTIONS_WITH_TWO_ARGS(FunctionDatetimeV2DateDiff)
REGISTER_ALL_DATEV2_FUNCTIONS_WITH_TWO_ARGS(FunctionDatetimeV2TimeDiff)

View File

@ -20,7 +20,6 @@
#include "gtest/gtest.h"
#include "vec/aggregate_functions/aggregate_function.h"
#include "vec/aggregate_functions/aggregate_function_min_max_by.h"
#include "vec/aggregate_functions/aggregate_function_simple_factory.h"
#include "vec/columns/column_vector.h"
#include "vec/data_types/data_type.h"
@ -31,7 +30,8 @@ const int agg_test_batch_size = 4096;
namespace doris::vectorized {
// declare function
void register_aggregate_function_min_max_by(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_min_by(AggregateFunctionSimpleFactory& factory);
void register_aggregate_function_max_by(AggregateFunctionSimpleFactory& factory);
class AggMinMaxByTest : public ::testing::TestWithParam<std::string> {};
@ -60,7 +60,8 @@ TEST_P(AggMinMaxByTest, min_max_by_test) {
// Prepare test function and parameters.
AggregateFunctionSimpleFactory factory;
register_aggregate_function_min_max_by(factory);
register_aggregate_function_min_by(factory);
register_aggregate_function_max_by(factory);
// Test on 2 kind of key types (int32, string).
for (int i = 0; i < 2; i++) {

View File

@ -852,51 +852,6 @@ TEST(VTimestampFunctionsTest, timediff_v2_test) {
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateV2, TypeIndex::Date};
DataSet data_set = {{{std::string("2019-07-18"), std::string("2019-07-18")}, 0.0},
{{std::string("2019-07-18"), std::string("2019-07-18")}, -0.0},
{{std::string("2019-00-18"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::Date, TypeIndex::DateV2};
DataSet data_set = {{{std::string("2019-07-18"), std::string("2019-07-18")}, 0.0},
{{std::string("2019-07-18"), std::string("2019-07-18")}, -0.0},
{{std::string("2019-00-18"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateV2};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-18")}, 0.0},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-18")}, -0.0},
{{std::string("2019-00-18 00:00:00"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateV2, TypeIndex::DateTime};
DataSet data_set = {
{{std::string("2019-07-18"), std::string("2019-07-18 00:00:00")}, 0.0},
{{std::string("2019-07-18"), std::string("2019-07-18 00:00:00")}, -0.0},
{{std::string("2019-00-18"), std::string("2019-07-18 00:00:00")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00 00:00:00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::DateTimeV2};
@ -908,57 +863,6 @@ TEST(VTimestampFunctionsTest, timediff_v2_test) {
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::Date};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-18")}, 0.0},
{{std::string("2019-07-18 00:00:10"), std::string("2019-07-18")}, 10.0},
{{std::string("2019-00-18 00:00:00"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::Date, TypeIndex::DateTimeV2};
DataSet data_set = {
{{std::string("2019-07-18"), std::string("2019-07-18 00:00:00")}, 0.0},
{{std::string("2019-07-18"), std::string("2019-07-18 00:00:10")}, -10.0},
{{std::string("2019-00-18"), std::string("2019-07-18 00:00:00")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00 00:00:00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateTimeV2};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-18 00:00:00")}, 0.0},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-18 00:00:10")}, -10.0},
{{std::string("2019-00-18 00:00:00"), std::string("2019-07-18 00:00:00")}, Null()},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-00 00:00:00")}, Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::DateTime};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-18 00:00:00")}, 0.0},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-18 00:00:00")},
-0.0},
{{std::string("2019-00-18 00:00:00.123"), std::string("2019-07-18 00:00:00")},
Null()},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-00 00:00:00")},
Null()}};
check_function<DataTypeTime, true>(func_name, input_types, data_set);
}
}
TEST(VTimestampFunctionsTest, datediff_v2_test) {
@ -975,52 +879,6 @@ TEST(VTimestampFunctionsTest, datediff_v2_test) {
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateV2, TypeIndex::Date};
DataSet data_set = {{{std::string("2019-07-18"), std::string("2019-07-19")}, -1},
{{std::string("2019-07-18"), std::string("2019-07-17")}, 1},
{{std::string("2019-00-18"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::Date, TypeIndex::DateV2};
DataSet data_set = {{{std::string("2019-07-18"), std::string("2019-07-19")}, -1},
{{std::string("2019-07-18"), std::string("2019-07-17")}, 1},
{{std::string("2019-00-18"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateV2};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-19")}, -1},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-17")}, 1},
{{std::string("2019-00-18 00:00:00"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateV2, TypeIndex::DateTime};
DataSet data_set = {
{{std::string("2019-07-18"), std::string("2019-07-19 00:00:00")}, -1},
{{std::string("2019-07-18"), std::string("2019-07-17 00:00:00")}, 1},
{{std::string("2019-00-18"), std::string("2019-07-18 00:00:00")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00 00:00:00")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::DateV2};
@ -1032,58 +890,6 @@ TEST(VTimestampFunctionsTest, datediff_v2_test) {
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::Date};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-19")}, -1},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-17")}, 1},
{{std::string("2019-00-18 00:00:00.123"), std::string("2019-07-18")}, Null()},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-00")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::Date, TypeIndex::DateTimeV2};
DataSet data_set = {
{{std::string("2019-07-18"), std::string("2019-07-19 00:00:00.123")}, -1},
{{std::string("2019-07-18"), std::string("2019-07-17 00:00:00.123")}, 1},
{{std::string("2019-00-18"), std::string("2019-07-18 00:00:00.123")}, Null()},
{{std::string("2019-07-18"), std::string("2019-07-00 00:00:00.123")}, Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateTimeV2};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-19 00:00:00.123")}, -1},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-17 00:00:00.123")}, 1},
{{std::string("2019-00-18 00:00:00"), std::string("2019-07-18 00:00:00.123")},
Null()},
{{std::string("2019-07-18 00:00:00"), std::string("2019-07-00 00:00:00.123")},
Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
{
InputTypeSet input_types = {TypeIndex::DateTimeV2, TypeIndex::DateTime};
DataSet data_set = {
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-19 00:00:00")}, -1},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-17 00:00:00")}, 1},
{{std::string("2019-00-18 00:00:00.123"), std::string("2019-07-18 00:00:00")},
Null()},
{{std::string("2019-07-18 00:00:00.123"), std::string("2019-07-00 00:00:00")},
Null()}};
check_function<DataTypeInt32, true>(func_name, input_types, data_set);
}
}
TEST(VTimestampFunctionsTest, date_format_v2_test) {

View File

@ -300,6 +300,10 @@ if [[ -z "${USE_DWARF}" ]]; then
USE_DWARF='OFF'
fi
if [[ -z "${DISPLAY_BUILD_TIME}" ]]; then
DISPLAY_BUILD_TIME='OFF'
fi
if [[ -z "${OUTPUT_BE_BINARY}" ]]; then
OUTPUT_BE_BINARY=${BUILD_BE}
fi
@ -362,6 +366,7 @@ echo "Get params:
USE_BTHREAD_SCANNER -- ${USE_BTHREAD_SCANNER}
ENABLE_STACKTRACE -- ${ENABLE_STACKTRACE}
DENABLE_CLANG_COVERAGE -- ${DENABLE_CLANG_COVERAGE}
DISPLAY_BUILD_TIME -- ${DISPLAY_BUILD_TIME}
"
# Clean and build generated code
@ -429,6 +434,7 @@ if [[ "${BUILD_BE}" -eq 1 ]]; then
-DBUILD_META_TOOL="${BUILD_META_TOOL}" \
-DSTRIP_DEBUG_INFO="${STRIP_DEBUG_INFO}" \
-DUSE_DWARF="${USE_DWARF}" \
-DDISPLAY_BUILD_TIME="${DISPLAY_BUILD_TIME}" \
-DUSE_MEM_TRACKER="${USE_MEM_TRACKER}" \
-DUSE_JEMALLOC="${USE_JEMALLOC}" \
-DUSE_BTHREAD_SCANNER="${USE_BTHREAD_SCANNER}" \

View File

@ -45,9 +45,7 @@ public class DateDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(IntegerType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE)
FunctionSignature.ret(IntegerType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class DaysDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class HoursDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class MinutesDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class MonthsDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class SecondsDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -46,9 +46,7 @@ public class TimeDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE)
FunctionSignature.ret(TimeV2Type.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class WeeksDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**

View File

@ -45,11 +45,7 @@ public class YearsDiff extends ScalarFunction
.args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateV2Type.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeV2Type.SYSTEM_DEFAULT, DateTimeType.INSTANCE),
FunctionSignature.ret(BigIntType.INSTANCE).args(DateTimeType.INSTANCE, DateTimeV2Type.SYSTEM_DEFAULT)
FunctionSignature.ret(BigIntType.INSTANCE).args(DateV2Type.INSTANCE, DateV2Type.INSTANCE)
);
/**