Skip to content

Commit d62ddbf

Browse files
committed
Better
1 parent e8da721 commit d62ddbf

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

lib/executor/src/execution/plan.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ impl<'exec> QueryPlanExecutor<'exec> {
378378
}
379379
}
380380
}
381+
let normalized_path = job.flatten_node_path.as_slice();
381382
'entity_loop: for (entity, hash) in entities
382383
.into_iter()
383384
.zip(job.representation_hashes.iter_mut())
@@ -387,7 +388,7 @@ impl<'exec> QueryPlanExecutor<'exec> {
387388
{
388389
for indexes_in_path in target_paths {
389390
let mut target: &mut Value<'exec> = &mut ctx.final_response;
390-
for path_segment in job.flatten_node_path.as_slice().iter() {
391+
for path_segment in normalized_path {
391392
match path_segment {
392393
FlattenNodePathSegment::List => {
393394
let index = indexes_in_path.pop_front().unwrap();
@@ -421,33 +422,29 @@ impl<'exec> QueryPlanExecutor<'exec> {
421422
}
422423
}
423424
FlattenNodePathSegment::Cast(type_condition) => {
424-
let mut type_name: &str = type_condition;
425425
if let Some(map) = target.as_object() {
426426
if let Ok(idx) = map.binary_search_by_key(
427427
&TYPENAME_FIELD_NAME,
428428
|(k, _)| k,
429429
) {
430-
if let Some((_, type_name_value)) =
431-
map.get(idx)
432-
{
433-
if let Some(type_name_str) =
434-
type_name_value.as_str()
430+
if let Some((_, type_name)) = map.get(idx) {
431+
if let Some(type_name) =
432+
type_name.as_str()
435433
{
436-
type_name = type_name_str;
434+
if !self
435+
.schema_metadata
436+
.possible_types
437+
.entity_satisfies_type_condition(
438+
type_name,
439+
type_condition,
440+
)
441+
{
442+
continue 'entity_loop; // Skip if type condition is not satisfied
443+
}
437444
}
438445
}
439446
}
440447
}
441-
if !self
442-
.schema_metadata
443-
.possible_types
444-
.entity_satisfies_type_condition(
445-
type_name,
446-
type_condition,
447-
)
448-
{
449-
continue 'entity_loop; // Skip if type condition is not satisfied
450-
}
451448
}
452449
}
453450
}

0 commit comments

Comments
 (0)