alisha-1000 commented on issue #649:
URL: https://github.com/apache/wayang/issues/649#issuecomment-3933691548

   The current PojoImplementation only supports projection of a single field by 
name via String fieldName. To support multiple field projection by both names 
and indexes, the implementation could be generalized as follows:
   
   Proposed Changes
   
   Replace single field storage
   
   Change private final String fieldName;
   
   To something like:
   
   private final List<String> fieldNames;
   private final List<Integer> fieldIndexes;
   
   Cache multiple Field objects
   
   Instead of a single Field, maintain:
   
   private List<Field> fields;
   
   Initialize them lazily inside apply() and cache them for reuse.
   
   Support projection by indexes
   
   Retrieve all declared fields:
   
   Field[] allFields = input.getClass().getDeclaredFields();
   
   Map provided indexes to corresponding Field instances.
   
   Optionally normalize indexes → field names internally to unify logic.
   
   Return composite output
   
   When projecting multiple fields, construct and return a Record containing 
all projected values.
   
   This would align projection behavior with relational semantics.
   
   Result
   
   This change would allow:
   
   Single-field projection (existing behavior)
   
   Multi-field projection by name
   
   Multi-field projection by index
   
   It would also make the descriptor more flexible and consistent with 
relational-style projection.
   
   Happy to contribute a patch if this approach aligns with the intended design.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to