fix: treat dict payloads as scalar values in values_count filter#1192
fix: treat dict payloads as scalar values in values_count filter#1192rahulkini31 wants to merge 1 commit into
Conversation
`get_value_counts` used `hasattr(value, "__len__")` to detect arrays, but `dict` also has `__len__`, causing JSON object payloads to be counted by their number of keys instead of as a single scalar value. Add `dict` to the `isinstance` exclusion alongside `str` so that dict payloads correctly count as 1. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Deploy Preview for poetic-froyo-8baba7 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR modifies the Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
get_value_countsinpayload_filters.pyusedhasattr(value, "__len__")to detect array-like values, butdictalso has__len__, causing JSON object payloads to be counted by their number of keys instead of as 1 scalar value.dictto theisinstanceexclusion alongsidestrso dict payloads correctly count as 1.gt,lt,gte,lte), and a regression guard for list counting.Test plan
pytest qdrant_client/local/tests/test_payload_filters.py -x— 3 tests pass (including new test)pytest qdrant_client/local/tests/ -x— 56 tests passpytest tests/test_in_memory.py tests/test_local_persistence.py tests/test_common.py tests/conversions/ tests/test_fastembed.py -x— 115 tests pass, 0 failuresmypy qdrant_client/local/payload_filters.py— no issuesruff format --check— already formatted🤖 Generated with Claude Code