Skip to content

Commit

Permalink
disallow assigning timestamp with time zone value from timestamp with…
Browse files Browse the repository at this point in the history
  • Loading branch information
kuron99 committed Aug 29, 2024
1 parent 3dfc6ae commit 4c7f6cf
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
8 changes: 0 additions & 8 deletions src/jogasaki/executor/conv/assignment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,6 @@ bool to_require_conversion(
takatori::type::data const& source_type,
takatori::type::data const& target_type
) {
// for time and timestamp, we don't require conversion even if they are different offset value
// since currently only UTC offset is supported, so offset=true/false doesn't make difference
if(source_type.kind() == takatori::type::type_kind::time_of_day) {
return target_type.kind() != takatori::type::type_kind::time_of_day;
}
if(source_type.kind() == takatori::type::type_kind::time_point) {
return target_type.kind() != takatori::type::type_kind::time_point;
}
return source_type != target_type;
}

Expand Down
4 changes: 2 additions & 2 deletions test/jogasaki/api/ddl_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ TEST_F(ddl_test, create_table_temporal_types) {
std::unordered_map<std::string, api::field_type_kind> variables{
{"p0", api::field_type_kind::date},
{"p1", api::field_type_kind::time_of_day},
{"p2", api::field_type_kind::time_of_day}, //TODO with time zone
{"p2", api::field_type_kind::time_of_day_with_time_zone},
{"p3", api::field_type_kind::time_point},
{"p4", api::field_type_kind::time_point}, //TODO with time zone
{"p4", api::field_type_kind::time_point_with_time_zone},
};
auto d2000_1_1 = date_v{2000, 1, 1};
auto t12_0_0 = time_of_day_v{12, 0, 0};
Expand Down
4 changes: 2 additions & 2 deletions test/jogasaki/api/sql_function_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ TEST_F(sql_function_test, min_max_time) {
TEST_F(sql_function_test, min_max_time_with_tz) {
execute_statement("CREATE TABLE t (c0 TIME WITH TIME ZONE NOT NULL PRIMARY KEY)");
std::unordered_map<std::string, api::field_type_kind> variables{
{"p0", api::field_type_kind::time_of_day},
{"p0", api::field_type_kind::time_of_day_with_time_zone},
};
auto td0 = time_of_day{12, 0, 0};
auto td1 = time_of_day{12, 0, 1};
Expand Down Expand Up @@ -551,7 +551,7 @@ TEST_F(sql_function_test, min_max_timestamp) {
TEST_F(sql_function_test, min_max_timestamp_with_tz) {
execute_statement("CREATE TABLE t (c0 TIMESTAMP WITH TIME ZONE NOT NULL PRIMARY KEY)");
std::unordered_map<std::string, api::field_type_kind> variables{
{"p0", api::field_type_kind::time_point},
{"p0", api::field_type_kind::time_point_with_time_zone},
};
auto tp0 = time_point{date{2000, 1, 1}, time_of_day{12, 0, 0}};
auto tp1 = time_point{date{2000, 1, 1}, time_of_day{12, 0, 1}};
Expand Down
2 changes: 1 addition & 1 deletion test/jogasaki/api/sql_temporal_types_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ TEST_F(sql_temporal_types_test, timestamp) {
execute_statement("CREATE TABLE T (C0 TIMESTAMP, C1 TIMESTAMP WITH TIME ZONE)");
std::unordered_map<std::string, api::field_type_kind> variables{
{"p0", api::field_type_kind::time_point},
{"p1", api::field_type_kind::time_point}, //TODO with time zone
{"p1", api::field_type_kind::time_point_with_time_zone},
};
auto tp = time_point{date{1, 1, 1}, time_of_day{0, 2, 48, 91383000ns}};
auto ps = api::create_parameter_set();
Expand Down

0 comments on commit 4c7f6cf

Please sign in to comment.