Skip to content

[codex] Add unwind array index support - #471

Merged
midagedev merged 1 commit into
mainfrom
codex/unwind-include-array-index-release
May 9, 2026
Merged

[codex] Add unwind array index support#471
midagedev merged 1 commit into
mainfrom
codex/unwind-include-array-index-release

Conversation

@midagedev

Copy link
Copy Markdown
Owner

Summary

  • add $unwind.includeArrayIndex support in the in-memory aggregation pipeline
  • emit Long indexes for array elements and null indexes for scalar / preserved null, missing, and empty inputs
  • bump the local development version target to 0.1.9-SNAPSHOT and refresh compatibility/release docs against the current 0.1.8 Maven Central baseline

Validation

  • .tooling/gradle-8.10.2/bin/gradle test --tests org.jongodb.engine.AggregationPipelineTest --tests org.jongodb.engine.InMemoryCollectionStoreAggregateTest
  • git diff --check
  • .tooling/gradle-8.10.2/bin/gradle clean test

Closes #470

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 코드 품질

  • UnwindSpec record가 includeArrayIndex 필드를 포함하도록 확장됨
  • setUnwindArrayIndex 헬퍼 메서드로 중복 제거
  • 기존 $unwind 동작에 대한 regression 방지

사소한 참고사항

  1. Empty 배열 경로 처리: 빈 배열이 있을 때 removePath를 호출하여 빈 배열을 제거하는 동작은 MongoDB와 일치합니다.

  2. 타입 선택: 인덱스를 Long으로 저장하는 것은 MongoDB가 BSON Int64를 사용하는 것과 일치합니다.

결론

이 PR은 $unwind.includeArrayIndex 기능을 올바르게 구현하고 있으며:

  • MongoDB 호환 semantic을 따릅니다
  • 적절한 input validation을 포함합니다
  • 포괄적인 테스트 커버리지를 제공합니다
  • 관련 문서를 일관되게 업데이트합니다
  • 기존 동작에 대한 regression이 없습니다

Blocking issue가 없으므로 APPROVE합니다.

Reviewed by Z.ai GLM via Claude Code Action

@midagedev
midagedev merged commit 4029c3a into main May 9, 2026
11 checks passed
@midagedev
midagedev deleted the codex/unwind-include-array-index-release branch May 9, 2026 13:56
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.

Add $unwind includeArrayIndex support for 0.1.9

1 participant