# 33-mix-1N-diffkeybreak — 1:N Matching with Different-Key Break ## 电信业务场景 线路+类型混合切替。先做线路↔通话类型的关联,再检测通话类型的变化。用于不同通话类型(语音/SMS/数据)的计费切换。 ## Purpose Demonstrates 1:N matching pattern where the key break detection uses a different key field than the match key, showing master-to-detail transitions. ## Test Coverage 1. **1:N matching** — One master (M0001) matched to three details 2. **Different-key break** — Key break is triggered by master ID change (M0001 -> M0002 -> M0003 -> M0004) 3. **Unmatched master ID** — Detail with M9999 has no matching master 4. **Summary per break** — Count and total per master ID group 5. **Final break** — Last group summary at end of file ## Data - 4 master records (M0001 through M0004) with names, types, amounts - 10 detail records with master ID references ## Key Techniques - In-memory master table loaded at startup - Key break on master ID field (different from detail transaction ID) - Accumulator per break group - Grand total across all groups - Unmatched ID detection and reporting