Skip to content

Commit 1332125

Browse files
authored
MV refresh protocol mapping (#24780)
Add MV refresh handler mapping to cpp
1 parent b910612 commit 1332125

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2418,6 +2418,10 @@ void to_json(json& j, const std::shared_ptr<ExecutionWriterTarget>& p) {
24182418
j = *std::static_pointer_cast<DeleteHandle>(p);
24192419
return;
24202420
}
2421+
if (type == "RefreshMaterializedViewHandle") {
2422+
j = *std::static_pointer_cast<RefreshMaterializedViewHandle>(p);
2423+
return;
2424+
}
24212425

24222426
throw TypeError(type + " no abstract type ExecutionWriterTarget ");
24232427
}
@@ -2450,6 +2454,13 @@ void from_json(const json& j, std::shared_ptr<ExecutionWriterTarget>& p) {
24502454
p = std::static_pointer_cast<ExecutionWriterTarget>(k);
24512455
return;
24522456
}
2457+
if (type == "RefreshMaterializedViewHandle") {
2458+
std::shared_ptr<RefreshMaterializedViewHandle> k =
2459+
std::make_shared<RefreshMaterializedViewHandle>();
2460+
j.get_to(*k);
2461+
p = std::static_pointer_cast<ExecutionWriterTarget>(k);
2462+
return;
2463+
}
24532464

24542465
throw TypeError(type + " no abstract type ExecutionWriterTarget ");
24552466
}
@@ -8450,9 +8461,13 @@ void from_json(const json& j, Range& p) {
84508461
}
84518462
} // namespace facebook::presto::protocol
84528463
namespace facebook::presto::protocol {
8464+
RefreshMaterializedViewHandle::RefreshMaterializedViewHandle() noexcept {
8465+
_type = "RefreshMaterializedViewHandle";
8466+
}
84538467

84548468
void to_json(json& j, const RefreshMaterializedViewHandle& p) {
84558469
j = json::object();
8470+
j["@type"] = "RefreshMaterializedViewHandle";
84568471
to_json_key(
84578472
j,
84588473
"handle",
@@ -8470,6 +8485,7 @@ void to_json(json& j, const RefreshMaterializedViewHandle& p) {
84708485
}
84718486

84728487
void from_json(const json& j, RefreshMaterializedViewHandle& p) {
8488+
p._type = j["@type"];
84738489
from_json_key(
84748490
j,
84758491
"handle",

presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1948,9 +1948,11 @@ void to_json(json& j, const Range& p);
19481948
void from_json(const json& j, Range& p);
19491949
} // namespace facebook::presto::protocol
19501950
namespace facebook::presto::protocol {
1951-
struct RefreshMaterializedViewHandle {
1951+
struct RefreshMaterializedViewHandle : public ExecutionWriterTarget {
19521952
InsertTableHandle handle = {};
19531953
SchemaTableName schemaTableName = {};
1954+
1955+
RefreshMaterializedViewHandle() noexcept;
19541956
};
19551957
void to_json(json& j, const RefreshMaterializedViewHandle& p);
19561958
void from_json(const json& j, RefreshMaterializedViewHandle& p);

presto-native-execution/presto_cpp/presto_protocol/core/presto_protocol_core.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ AbstractClasses:
124124
ExecutionWriterTarget:
125125
super: JsonEncodedSubclass
126126
subclasses:
127-
- { name: CreateHandle, key: CreateHandle }
128-
- { name: InsertHandle, key: InsertHandle }
129-
- { name: DeleteHandle, key: DeleteHandle }
127+
- { name: CreateHandle, key: CreateHandle }
128+
- { name: InsertHandle, key: InsertHandle }
129+
- { name: DeleteHandle, key: DeleteHandle }
130+
- { name: RefreshMaterializedViewHandle, key: RefreshMaterializedViewHandle }
130131

131132
InputDistribution:
132133
super: JsonEncodedSubclass

0 commit comments

Comments
 (0)