@@ -378,6 +378,7 @@ impl<'exec> QueryPlanExecutor<'exec> {
378
378
}
379
379
}
380
380
}
381
+ let normalized_path = job. flatten_node_path . as_slice ( ) ;
381
382
' entity_loop: for ( entity, hash) in entities
382
383
. into_iter ( )
383
384
. zip ( job. representation_hashes . iter_mut ( ) )
@@ -387,7 +388,7 @@ impl<'exec> QueryPlanExecutor<'exec> {
387
388
{
388
389
for indexes_in_path in target_paths {
389
390
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 {
391
392
match path_segment {
392
393
FlattenNodePathSegment :: List => {
393
394
let index = indexes_in_path. pop_front ( ) . unwrap ( ) ;
@@ -421,33 +422,29 @@ impl<'exec> QueryPlanExecutor<'exec> {
421
422
}
422
423
}
423
424
FlattenNodePathSegment :: Cast ( type_condition) => {
424
- let mut type_name: & str = type_condition;
425
425
if let Some ( map) = target. as_object ( ) {
426
426
if let Ok ( idx) = map. binary_search_by_key (
427
427
& TYPENAME_FIELD_NAME ,
428
428
|( k, _) | k,
429
429
) {
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 ( )
435
433
{
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
+ }
437
444
}
438
445
}
439
446
}
440
447
}
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
- }
451
448
}
452
449
}
453
450
}
0 commit comments