diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp index 91df7b2959316..63baf0054e053 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp @@ -2410,6 +2410,10 @@ void to_json(json& j, const std::shared_ptr& p) { j = *std::static_pointer_cast(p); return; } + if (type == "RefreshMaterializedViewHandle") { + j = *std::static_pointer_cast(p); + return; + } if (type == "InsertHandle") { j = *std::static_pointer_cast(p); return; @@ -2418,10 +2422,6 @@ void to_json(json& j, const std::shared_ptr& p) { j = *std::static_pointer_cast(p); return; } - if (type == "RefreshMaterializedViewHandle") { - j = *std::static_pointer_cast(p); - return; - } throw TypeError(type + " no abstract type ExecutionWriterTarget "); } @@ -2442,21 +2442,20 @@ void from_json(const json& j, std::shared_ptr& p) { p = std::static_pointer_cast(k); return; } - if (type == "InsertHandle") { + if (type == "RefreshMaterializedViewHandle") { std::shared_ptr k = std::make_shared(); j.get_to(*k); p = std::static_pointer_cast(k); return; } - if (type == "DeleteHandle") { - std::shared_ptr k = std::make_shared(); + if (type == "InsertHandle") { + std::shared_ptr k = std::make_shared(); j.get_to(*k); p = std::static_pointer_cast(k); return; } - if (type == "RefreshMaterializedViewHandle") { - std::shared_ptr k = - std::make_shared(); + if (type == "DeleteHandle") { + std::shared_ptr k = std::make_shared(); j.get_to(*k); p = std::static_pointer_cast(k); return; @@ -8461,13 +8460,9 @@ void from_json(const json& j, Range& p) { } } // namespace facebook::presto::protocol namespace facebook::presto::protocol { -RefreshMaterializedViewHandle::RefreshMaterializedViewHandle() noexcept { - _type = "RefreshMaterializedViewHandle"; -} void to_json(json& j, const RefreshMaterializedViewHandle& p) { j = json::object(); - j["@type"] = "RefreshMaterializedViewHandle"; to_json_key( j, "handle", @@ -8485,7 +8480,6 @@ void to_json(json& j, const RefreshMaterializedViewHandle& p) { } void from_json(const json& j, RefreshMaterializedViewHandle& p) { - p._type = j["@type"]; from_json_key( j, "handle", diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h index b4d306fbecaef..00ec0a569cc2d 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h @@ -1948,11 +1948,9 @@ void to_json(json& j, const Range& p); void from_json(const json& j, Range& p); } // namespace facebook::presto::protocol namespace facebook::presto::protocol { -struct RefreshMaterializedViewHandle : public ExecutionWriterTarget { +struct RefreshMaterializedViewHandle { InsertTableHandle handle = {}; SchemaTableName schemaTableName = {}; - - RefreshMaterializedViewHandle() noexcept; }; void to_json(json& j, const RefreshMaterializedViewHandle& p); void from_json(const json& j, RefreshMaterializedViewHandle& p); diff --git a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml index fd726b74004c6..5f1180ae2e191 100644 --- a/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml +++ b/presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml @@ -124,10 +124,11 @@ AbstractClasses: ExecutionWriterTarget: super: JsonEncodedSubclass subclasses: - - { name: CreateHandle, key: CreateHandle } - - { name: InsertHandle, key: InsertHandle } - - { name: DeleteHandle, key: DeleteHandle } - - { name: RefreshMaterializedViewHandle, key: RefreshMaterializedViewHandle } + - { name: CreateHandle, key: CreateHandle } + - { name: InsertHandle, key: RefreshMaterializedViewHandle } + - { name: InsertHandle, key: InsertHandle } + - { name: DeleteHandle, key: DeleteHandle } + InputDistribution: super: JsonEncodedSubclass