Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement] fix typo #9743

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion be/src/vec/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ struct TypeName<uint24_t> {
};
template <>
struct TypeName<StringValue> {
static const char* get() { return "SringValue"; }
static const char* get() { return "StringValue"; }
};

template <>
Expand Down
20 changes: 10 additions & 10 deletions be/test/vec/function/function_array_element_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ TEST(function_array_element_test, element_at) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::DateTime, TypeIndex::Int64};

Array vec = {str_to_data_time("2022-01-02 01:00:00"), str_to_data_time(""),
str_to_data_time("2022-07-08 03:00:00")};
Array vec = {str_to_date_time("2022-01-02 01:00:00"), str_to_date_time(""),
str_to_date_time("2022-07-08 03:00:00")};
DataSet data_set = {{{vec, Int64(0)}, Null()},
{{vec, Int64(1)}, str_to_data_time("2022-01-02 01:00:00")},
{{vec, Int64(1)}, str_to_date_time("2022-01-02 01:00:00")},
{{vec, Int64(4)}, Null()},
{{vec, Int64(-1)}, str_to_data_time("2022-07-08 03:00:00")},
{{vec, Int64(-2)}, str_to_data_time("")},
{{vec, Int64(-1)}, str_to_date_time("2022-07-08 03:00:00")},
{{vec, Int64(-2)}, str_to_date_time("")},
{{vec, Int64(-4)}, Null()},
{{Null(), Int64(1)}, Null()},
{{empty_arr, Int64(0)}, Null()},
Expand All @@ -109,13 +109,13 @@ TEST(function_array_element_test, element_at) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Date, TypeIndex::Int64};

Array vec = {str_to_data_time("2022-01-02"), str_to_data_time(""),
str_to_data_time("2022-07-08")};
Array vec = {str_to_date_time("2022-01-02"), str_to_date_time(""),
str_to_date_time("2022-07-08")};
DataSet data_set = {{{vec, Int64(0)}, Null()},
{{vec, Int64(1)}, str_to_data_time("2022-01-02")},
{{vec, Int64(1)}, str_to_date_time("2022-01-02")},
{{vec, Int64(4)}, Null()},
{{vec, Int64(-1)}, str_to_data_time("2022-07-08")},
{{vec, Int64(-2)}, str_to_data_time("")},
{{vec, Int64(-1)}, str_to_date_time("2022-07-08")},
{{vec, Int64(-2)}, str_to_date_time("")},
{{vec, Int64(-4)}, Null()},
{{Null(), Int64(1)}, Null()},
{{empty_arr, Int64(0)}, Null()},
Expand Down
16 changes: 8 additions & 8 deletions be/test/vec/function/function_array_index_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ TEST(function_array_index_test, array_contains) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Date, TypeIndex::Date};

Array vec = {str_to_data_time("2022-01-02", false), str_to_data_time("", false),
str_to_data_time("2022-07-08", false)};
Array vec = {str_to_date_time("2022-01-02", false), str_to_date_time("", false),
str_to_date_time("2022-07-08", false)};
DataSet data_set = {{{vec, std::string("2022-01-02")}, UInt8(1)},
{{vec, std::string("")}, UInt8(1)},
{{vec, std::string("2022-01-03")}, UInt8(0)},
Expand All @@ -128,8 +128,8 @@ TEST(function_array_index_test, array_contains) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::DateTime, TypeIndex::DateTime};

Array vec = {str_to_data_time("2022-01-02 00:00:00"), str_to_data_time(""),
str_to_data_time("2022-07-08 00:00:00")};
Array vec = {str_to_date_time("2022-01-02 00:00:00"), str_to_date_time(""),
str_to_date_time("2022-07-08 00:00:00")};
DataSet data_set = {{{vec, std::string("2022-01-02 00:00:00")}, UInt8(1)},
{{vec, std::string("")}, UInt8(1)},
{{vec, std::string("2022-01-03 00:00:00")}, UInt8(0)},
Expand Down Expand Up @@ -215,8 +215,8 @@ TEST(function_array_index_test, array_position) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::Date, TypeIndex::Date};

Array vec = {str_to_data_time("2022-01-02", false), str_to_data_time("", false),
str_to_data_time("2022-07-08", false)};
Array vec = {str_to_date_time("2022-01-02", false), str_to_date_time("", false),
str_to_date_time("2022-07-08", false)};
DataSet data_set = {{{vec, std::string("2022-01-02")}, Int64(1)},
{{vec, std::string("")}, Int64(2)},
{{vec, std::string("2022-01-03")}, Int64(0)},
Expand All @@ -230,8 +230,8 @@ TEST(function_array_index_test, array_position) {
{
InputTypeSet input_types = {TypeIndex::Array, TypeIndex::DateTime, TypeIndex::DateTime};

Array vec = {str_to_data_time("2022-01-02 00:00:00"), str_to_data_time(""),
str_to_data_time("2022-07-08 00:00:00")};
Array vec = {str_to_date_time("2022-01-02 00:00:00"), str_to_date_time(""),
str_to_date_time("2022-07-08 00:00:00")};
DataSet data_set = {{{vec, std::string("2022-01-02 00:00:00")}, Int64(1)},
{{vec, std::string("")}, Int64(2)},
{{vec, std::string("2022-01-03 00:00:00")}, Int64(0)},
Expand Down
4 changes: 2 additions & 2 deletions be/test/vec/function/function_ifnull_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ TEST(IfNullTest, String_Int_Test) {
std::string func_name = "ifnull";
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateTime};
DataSet data_set = {{{std::string("2021-10-24 12:32:31"), std::string("2021-10-24 13:00:01")},
str_to_data_time("2021-10-24 12:32:31")},
str_to_date_time("2021-10-24 12:32:31")},
{{Null(), std::string("2021-10-24 13:00:01")},
str_to_data_time("2021-10-24 13:00:01")}};
str_to_date_time("2021-10-24 13:00:01")}};

check_function<DataTypeDateTime, true>(func_name, input_types, data_set);
}
Expand Down
4 changes: 2 additions & 2 deletions be/test/vec/function/function_nullif_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ TEST(NullIfTest, String_Int_Test) {
InputTypeSet input_types = {TypeIndex::DateTime, TypeIndex::DateTime};
DataSet data_set = {
{{std::string("2021-10-24 12:32:31"), std::string("2021-10-24 13:00:01")},
str_to_data_time("2021-10-24 12:32:31")},
str_to_date_time("2021-10-24 12:32:31")},
{{std::string("2021-10-24 13:00:01"), std::string("2021-10-24 13:00:01")}, Null()},
{{std::string("2021-10-24 13:00:01"), Null()},
str_to_data_time("2021-10-24 13:00:01")}};
str_to_date_time("2021-10-24 13:00:01")}};

check_function<DataTypeDateTime, true>(func_name, input_types, data_set);
}
Expand Down
8 changes: 4 additions & 4 deletions be/test/vec/function/function_string_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,13 +1011,13 @@ TEST(function_string_test, function_str_to_date_test) {
DataSet data_set = {
{{Null(), std::string("%Y-%m-%d %H:%i:%s")}, {Null()}},
{{std::string("2014-12-21 12:34:56"), std::string("%Y-%m-%d %H:%i:%s")},
str_to_data_time("2014-12-21 12:34:56", false)},
str_to_date_time("2014-12-21 12:34:56", false)},
{{std::string("2014-12-21 12:34%3A56"), std::string("%Y-%m-%d %H:%i%%3A%s")},
str_to_data_time("2014-12-21 12:34:56", false)},
str_to_date_time("2014-12-21 12:34:56", false)},
{{std::string("11/09/2011"), std::string("%m/%d/%Y")},
str_to_data_time("2011-11-09", false)},
str_to_date_time("2011-11-09", false)},
{{std::string("2020-09-01"), std::string("%Y-%m-%d %H:%i:%s")},
str_to_data_time("2020-09-01 00:00:00", false)}};
str_to_date_time("2020-09-01 00:00:00", false)}};
check_function<DataTypeDateTime, true>(func_name, input_types, data_set);
}

Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/function/function_test_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "vec/function/function_test_util.h"

namespace doris::vectorized {
int64_t str_to_data_time(std::string datetime_str, bool data_time) {
int64_t str_to_date_time(std::string datetime_str, bool data_time) {
VecDateTimeValue v;
v.from_date_str(datetime_str.c_str(), datetime_str.size());
if (data_time) { //bool data_time only to simplifly means data_time or data to cast, just use in time-functions uint test
Expand Down
2 changes: 1 addition & 1 deletion be/test/vec/function/function_test_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ using InputDataSet = std::vector<std::vector<std::any>>; // without result
using DataSet = std::vector<std::pair<std::vector<std::any>, std::any>>;
using InputTypeSet = std::vector<std::any>;

int64_t str_to_data_time(std::string datetime_str, bool data_time = true);
int64_t str_to_date_time(std::string datetime_str, bool data_time = true);

namespace ut_type {
using TINYINT = int8_t;
Expand Down
Loading