valkey icon indicating copy to clipboard operation
valkey copied to clipboard

Update the misleading zdiff() comment on empty first key handling.

Open kyle-yh-kim opened this issue 1 year ago • 1 comments

Currently, zdiff() becomes a no-op in the case that the first key is empty.

The existing comment of "Skip everything if the smallest input is empty" is misleading, as qsort is bypassed for the case of ZDIFF. There's no guarantee that the first key holds the smallest cardinality.

The real reason behind such bypass is the following. ZDIFF computes the difference between the first and all successive input sorted sets. Meaning, if the first key is empty, we cannot reduce further from an already empty collection, and thus zdiff() becomes a no-op.

kyle-yh-kim avatar Jul 04 '24 18:07 kyle-yh-kim

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 72.22%. Comparing base (cef8822) to head (29722e8). :warning: Report is 39 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable     #747      +/-   ##
============================================
+ Coverage     72.09%   72.22%   +0.13%     
============================================
  Files           127      127              
  Lines         70774    70774              
============================================
+ Hits          51021    51114      +93     
+ Misses        19753    19660      -93     
Files with missing lines Coverage Δ
src/t_zset.c 96.83% <ø> (ø)

... and 10 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jul 04 '24 19:07 codecov[bot]

@kyle-yh-kim Do you want to update this or should we close it?

madolson avatar Sep 05 '25 18:09 madolson

Sure, I'll go ahead and update only the comment, and leave the code implementation as is - by Viktor's recommendation.

kyle-yh-kim avatar Sep 08 '25 20:09 kyle-yh-kim

PR has been updated!

kyle-yh-kim avatar Sep 09 '25 17:09 kyle-yh-kim