Skip to content

Support multiple field projection, by names and indexes for Pojo (#649)#710

Open
JunWang222 wants to merge 1 commit intoapache:mainfrom
JunWang222:feature/projection-descriptor-multi-field
Open

Support multiple field projection, by names and indexes for Pojo (#649)#710
JunWang222 wants to merge 1 commit intoapache:mainfrom
JunWang222:feature/projection-descriptor-multi-field

Conversation

@JunWang222
Copy link

@JunWang222 JunWang222 commented Mar 2, 2026

issue#649 Revise implementation to support multiple field projection, by names

  • Add MultiFieldPojoImplementation static class following the existing PojoImplementation and RecordImplementation pattern
  • Add createForPojoByNames() factory for projecting multiple POJO fields by name into a Record
  • Add createForPojoByIndexes() factory for projecting POJO fields by their declared index into a Record
  • Restore RecordImplementation and createRecordJavaImplementation for consistency with the original codebase style
  • Add 9 new tests covering multi-field by name, by index, field reordering, null values, out-of-bounds, and nonexistent field error cases

Plan
Add a new MultiFieldPojoImplementation class following the same pattern as the existing PojoImplementation and RecordImplementation. It takes multiple field names, extracts each field from the input POJO via reflection, and packs the values into a Record.
Expose it through two new factory methods — one for field names, one for indexes — and keep the existing single-field path untouched for backward compatibility. The existing constructor routes automatically:

  • one field → old PojoImplementation (returns the raw value, same behavior as before)
  • multiple fields → new MultiFieldPojoImplementation (returns a Record).

- Add MultiFieldPojoImplementation static class following the existing
  PojoImplementation and RecordImplementation pattern
- Add createForPojoByNames() factory for projecting multiple POJO fields
  by name into a Record
- Add createForPojoByIndexes() factory for projecting POJO fields by
  their declared index into a Record
- Restore RecordImplementation and createRecordJavaImplementation for
  consistency with the original codebase style
- Add 9 new tests covering multi-field by name, by index, field reordering,
  null values, out-of-bounds, and nonexistent field error cases
@JunWang222 JunWang222 changed the title Add multi-field and index-based POJO projection to ProjectionDescriptor Support multiple field projection, by names and indexes (#649) Mar 2, 2026
@JunWang222 JunWang222 changed the title Support multiple field projection, by names and indexes (#649) Support multiple field projection, by names and indexes for Pojo (#649) Mar 2, 2026
@zkaoudi zkaoudi requested a review from mspruc March 4, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant