Skip to content

Commit

Permalink
Fix assertions for stream_node_template, upstream_actors, and nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
shanicky committed Dec 5, 2023
1 parent 4de2618 commit 266890e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion proto/meta.proto
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ message TableFragments {
// When we use RENDER_TEMPLATE, template compression is enabled during the conversion between PbTableFragments and model::TableFragments.
// This avoids pointless repetition in each PbActor’s StreamNode within PbFragment.
// When RENDER_TEMPLATE is activated, the stream_node_template in PbFragment should not be empty.
// Also, the nodes in the original actors field will be disregarded (if template compression is enabled, an irrelevant NoOp should be placed here) and rendered when converted to model::TableFragments.
// Also, the nodes in the original actors field will be disregarded and rendered when converted to model::TableFragments.
GraphRenderType graph_render_type = 7;
}

Expand Down
12 changes: 3 additions & 9 deletions src/common/src/util/table_fragments_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn uncompress_table_fragments(table_fragments: &mut PbTableFragments) {
for fragment in table_fragments.fragments.values_mut() {
assert!(
fragment.stream_node_template.is_some(),
"fragment.stream_node_template should be Some() when render type is RenderTemplate"
"fragment.stream_node_template should not be None when render type is RenderTemplate"
);

for actor in &mut fragment.actors {
Expand All @@ -57,18 +57,12 @@ pub fn uncompress_table_fragments(table_fragments: &mut PbTableFragments) {
);

actor.nodes = pb_nodes;

assert!(
!actor.upstream_actors_by_fragment.is_empty(),
"actor.upstream_actors_by_fragment should not be empty when render type is RenderTemplate"
);

actor.upstream_actors_by_fragment.clear();
}

assert!(
fragment.stream_node_template.is_some(),
"fragment.stream_node_template should be Some() when render type is RenderTemplate"
"fragment.stream_node_template should not be None when render type is RenderTemplate"
);
fragment.stream_node_template = None;
}
Expand Down Expand Up @@ -134,7 +128,7 @@ pub fn compress_table_fragments(table_fragments: &mut PbTableFragments) {

assert!(
actor.nodes.is_some(),
"actor.nodes should be Some() when render type is unspecified"
"actor.nodes should not be None when render type is unspecified"
);

actor.nodes = None;
Expand Down

0 comments on commit 266890e

Please sign in to comment.