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 79978eda2d982..91df7b2959316 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 @@ -2418,6 +2418,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; + } throw TypeError(type + " no abstract type ExecutionWriterTarget "); } @@ -2450,6 +2454,13 @@ void from_json(const json& j, std::shared_ptr& p) { p = std::static_pointer_cast(k); return; } + if (type == "RefreshMaterializedViewHandle") { + std::shared_ptr k = + std::make_shared(); + j.get_to(*k); + p = std::static_pointer_cast(k); + return; + } throw TypeError(type + " no abstract type ExecutionWriterTarget "); } @@ -8450,9 +8461,13 @@ 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", @@ -8470,6 +8485,7 @@ 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 00ec0a569cc2d..b4d306fbecaef 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,9 +1948,11 @@ 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 { +struct RefreshMaterializedViewHandle : public ExecutionWriterTarget { 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 4dfefa846c4f0..fd726b74004c6 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,9 +124,10 @@ AbstractClasses: ExecutionWriterTarget: super: JsonEncodedSubclass subclasses: - - { name: CreateHandle, key: CreateHandle } - - { name: InsertHandle, key: InsertHandle } - - { name: DeleteHandle, key: DeleteHandle } + - { name: CreateHandle, key: CreateHandle } + - { name: InsertHandle, key: InsertHandle } + - { name: DeleteHandle, key: DeleteHandle } + - { name: RefreshMaterializedViewHandle, key: RefreshMaterializedViewHandle } InputDistribution: super: JsonEncodedSubclass