Chunk iteration filtering?

not sure what you want to achieve but if you need to get all components on a given entity

public class GetChunks : ComponentSystem{
  [Inject] private EndFrameBarrier _barrier; 
  private ComponentGroup _query;
  protected override void OnCreateManager(){
    _query = GetComponentGroup(ComponentType.Create<B>());
  }

  protected override void OnUpdate(){
    var chunks = _query.CreateArchetypeChunkArray( Allocator.TempJob ); // get chunks
    if (chunks.Length == 0){ chunks.Dispose(); return; } // do nothing if no chunks found
  
    var entityChunkType = GetArchetypeChunkEntityType(); 
  
    foreach( var chunk in chunks ){ // for each chunk
      var archetype = chunk.Archetype;
      ComponentType[] types = archetype.ComponentTypes;
      for( int j = 0; j < types.Length; j++ ){// list chunk component types
        Debug.Log( types[j] );
      }
      
      var entities = chunk.GetNativeArray (entityChunkType);
      for( int i = 0; i < entities.Length; i++ ){ // serialize entityes with all components to json
        var entity = entities[i];
        var container = new EntityContainer(EntityManager, entity);
        Debug.Log( JsonSerializer.Serialize(ref container) );
      }
    }
  
    chunks.Dispose(); // dealocate native container
  }
 
}

here is my very old post on this topic

  1. Serialization. How to iterate over all components of a given entity?
  2. Serialization Again