[codex] Add unwind array index support - #471
Conversation
There was a problem hiding this comment.
APPROVE
Summary
이 PR은 $unwind.includeArrayIndex 옵션을 in-memory aggregation pipeline에 추가합니다. 구현은 MongoDB 호환성을 잘 따르고 있으며, 문서 업데이트와 테스트 커버리지가 적절합니다.
세부 검토
1. MongoDB 호환성 (Correctness)
구현은 MongoDB $unwind.includeArrayIndex의 핵심 semantic을 올바르게 따르고 있습니다:
- 배열 요소: 인덱스를
Long값으로 emit (0, 1, 2, ...) - 스칼라 값:
null인덱스 emit - 빈 배열 (
preserveNullAndEmptyArrays=true):null인덱스 emit, 빈 배열은 문서에서 제거됨 - 누락된 필드:
null인덱스 emit null값:null인덱스 emit
이는 MongoDB의 includeArrayIndex 동방식과 일치합니다.
참고: AggregationPipeline.java:589-608
2. Input Validation
유효하지 않은 includeArrayIndex 필드 이름에 대한 validation이 적절합니다:
$로 시작하는 필드 이름 거부- 빈 문자열 거부
IllegalArgumentException발생
참고: AggregationPipeline.java:645-652
3. 문서 업데이트
호환성 문서가 올바르게 업데이트되었습니다:
docs/COMPATIBILITY.md:$unwind설명이(including includeArrayIndex)로 변경되고, "Not implemented" 목록에서 제거됨docs/SUPPORT_MATRIX.md:aggregation.match-project-group피처에$unwind.includeArrayIndex추가됨README.md: Compatibility snapshot에$unwind.includeArrayIndex추가됨CHANGELOG.md: 새 기능이 문서화됨
4. 테스트 커버리지
AggregationPipelineTest에 포괄적인 테스트가 추가되었습니다:
- 배열 값의 인덱스 추적 (0L, 1L, ...)
- 스칼라 값의 null 인덱스
- 빈 배열의 null 인덱스 + 필드 제거
- 누락된 필드의 null 인덱스
null값의 null 인덱스- 유효하지 않은 필드 이름에 대한 validation
참고: AggregationPipelineTest.java:54-100
5. Release 문서 업데이트
docs/RELEASE_CHECKLIST.md: 최신 Java 릴리스 태그가v0.1.8로, 다음 태그 후보가v0.1.9로 올바르게 업데이트됨- 로컬 개발 버전이
0.1.9-SNAPSHOT으로 bump됨
6. 코드 품질
UnwindSpecrecord가includeArrayIndex필드를 포함하도록 확장됨setUnwindArrayIndex헬퍼 메서드로 중복 제거- 기존
$unwind동작에 대한 regression 방지
사소한 참고사항
-
Empty 배열 경로 처리: 빈 배열이 있을 때
removePath를 호출하여 빈 배열을 제거하는 동작은 MongoDB와 일치합니다. -
타입 선택: 인덱스를
Long으로 저장하는 것은 MongoDB가 BSON Int64를 사용하는 것과 일치합니다.
결론
이 PR은 $unwind.includeArrayIndex 기능을 올바르게 구현하고 있으며:
- MongoDB 호환 semantic을 따릅니다
- 적절한 input validation을 포함합니다
- 포괄적인 테스트 커버리지를 제공합니다
- 관련 문서를 일관되게 업데이트합니다
- 기존 동작에 대한 regression이 없습니다
Blocking issue가 없으므로 APPROVE합니다.
Reviewed by Z.ai GLM via Claude Code Action
Summary
$unwind.includeArrayIndexsupport in the in-memory aggregation pipelineLongindexes for array elements andnullindexes for scalar / preserved null, missing, and empty inputs0.1.9-SNAPSHOTand refresh compatibility/release docs against the current0.1.8Maven Central baselineValidation
.tooling/gradle-8.10.2/bin/gradle test --tests org.jongodb.engine.AggregationPipelineTest --tests org.jongodb.engine.InMemoryCollectionStoreAggregateTestgit diff --check.tooling/gradle-8.10.2/bin/gradle clean testCloses #470