Skip to content

Commit

Permalink
Merge remote-tracking branch 'pingcap/master' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
solotzg committed Aug 19, 2021
2 parents bcd5f98 + 00f985c commit a028da8
Show file tree
Hide file tree
Showing 21 changed files with 2,323 additions and 281 deletions.
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -361,10 +361,14 @@ if (ENABLE_TESTS)
enable_testing()
endif ()

include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-mvpclmulqdq -Werror -Wall -Wextra" TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT)
if(TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT)
add_definitions(-DTIFLASH_COMPILER_VPCLMULQDQ_SUPPORT=1)
if (ARCH_AMD64)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-mvpclmulqdq -Werror -Wall -Wextra" TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT)
if(TIFLASH_COMPILER_VPCLMULQDQ_SUPPORT)
add_definitions(-DTIFLASH_COMPILER_VPCLMULQDQ_SUPPORT=1)
else()
add_definitions(-DTIFLASH_COMPILER_VPCLMULQDQ_SUPPORT=0)
endif()
else()
add_definitions(-DTIFLASH_COMPILER_VPCLMULQDQ_SUPPORT=0)
endif()
Expand Down
58 changes: 58 additions & 0 deletions dbms/src/Debug/dbgFuncCoprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,14 @@ std::unordered_map<String, tipb::ScalarFuncSig> func_name_to_sig({
{"cast_decimal_datetime", tipb::ScalarFuncSig::CastDecimalAsTime},
{"cast_time_datetime", tipb::ScalarFuncSig::CastTimeAsTime},
{"cast_string_datetime", tipb::ScalarFuncSig::CastStringAsTime},
{"round_int", tipb::ScalarFuncSig::RoundInt},
{"round_uint", tipb::ScalarFuncSig::RoundInt},
{"round_dec", tipb::ScalarFuncSig::RoundDec},
{"round_real", tipb::ScalarFuncSig::RoundReal},
{"round_with_frac_int", tipb::ScalarFuncSig::RoundWithFracInt},
{"round_with_frac_uint", tipb::ScalarFuncSig::RoundWithFracInt},
{"round_with_frac_dec", tipb::ScalarFuncSig::RoundWithFracDec},
{"round_with_frac_real", tipb::ScalarFuncSig::RoundWithFracReal},

});

Expand Down Expand Up @@ -777,11 +785,41 @@ void astToPB(const DAGSchema & input, ASTPtr ast, tipb::Expr * expr, uint32_t co
ft->set_collate(collator_id);
break;
}
case tipb::ScalarFuncSig::RoundInt:
case tipb::ScalarFuncSig::RoundWithFracInt:
{
expr->set_sig(it_sig->second);
auto * ft = expr->mutable_field_type();
ft->set_tp(TiDB::TypeLongLong);
if (it_sig->first.find("uint") != std::string::npos)
ft->set_flag(TiDB::ColumnFlagUnsigned);
ft->set_collate(collator_id);
break;
}
case tipb::ScalarFuncSig::RoundDec:
case tipb::ScalarFuncSig::RoundWithFracDec:
{
expr->set_sig(it_sig->second);
auto * ft = expr->mutable_field_type();
ft->set_tp(TiDB::TypeNewDecimal);
ft->set_collate(collator_id);
break;
}
case tipb::ScalarFuncSig::RoundReal:
case tipb::ScalarFuncSig::RoundWithFracReal:
{
expr->set_sig(it_sig->second);
auto * ft = expr->mutable_field_type();
ft->set_tp(TiDB::TypeDouble);
ft->set_collate(collator_id);
break;
}
default:
{
expr->set_sig(it_sig->second);
auto * ft = expr->mutable_field_type();
ft->set_tp(TiDB::TypeLongLong);
std::cerr << ft->flag() << std::endl;
ft->set_flag(TiDB::ColumnFlagUnsigned);
ft->set_collate(collator_id);
break;
Expand Down Expand Up @@ -1666,6 +1704,26 @@ TiDB::ColumnInfo compileExpr(const DAGSchema & input, ASTPtr ast)
ci.tp = TiDB::TypeDouble;
break;
}
case tipb::ScalarFuncSig::RoundInt:
case tipb::ScalarFuncSig::RoundWithFracInt:
{
ci.tp = TiDB::TypeLongLong;
if (it_sig->first.find("uint") != std::string::npos)
ci.flag = TiDB::ColumnFlagUnsigned;
break;
}
case tipb::ScalarFuncSig::RoundDec:
case tipb::ScalarFuncSig::RoundWithFracDec:
{
ci.tp = TiDB::TypeNewDecimal;
break;
}
case tipb::ScalarFuncSig::RoundReal:
case tipb::ScalarFuncSig::RoundWithFracReal:
{
ci.tp = TiDB::TypeDouble;
break;
}
default:
ci.tp = TiDB::TypeLongLong;
ci.flag = TiDB::ColumnFlagUnsigned;
Expand Down
6 changes: 3 additions & 3 deletions dbms/src/Flash/Coprocessor/DAGUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,9 @@ std::unordered_map<tipb::ScalarFuncSig, String> scalar_func_map({
{tipb::ScalarFuncSig::RoundReal, "tidbRound"},
{tipb::ScalarFuncSig::RoundInt, "tidbRound"},
{tipb::ScalarFuncSig::RoundDec, "tidbRound"},
// {tipb::ScalarFuncSig::RoundWithFracReal, "tidbRoundWithFrac"},
// {tipb::ScalarFuncSig::RoundWithFracInt, "tidbRoundWithFrac"},
// {tipb::ScalarFuncSig::RoundWithFracDec, "tidbRoundWithFrac"},
{tipb::ScalarFuncSig::RoundWithFracReal, "tidbRoundWithFrac"},
{tipb::ScalarFuncSig::RoundWithFracInt, "tidbRoundWithFrac"},
{tipb::ScalarFuncSig::RoundWithFracDec, "tidbRoundWithFrac"},

{tipb::ScalarFuncSig::Log1Arg, "log"},
{tipb::ScalarFuncSig::Log2Args, "log2args"},
Expand Down
Loading

0 comments on commit a028da8

Please sign in to comment.