kocolosk commented on issue #1346: Add _approx_count_distinct as a builtin reduce function URL: https://github.com/apache/couchdb/pull/1346#issuecomment-394529767 So I realized we have one issue we need to discuss here: collation. The reduce function is inserting each key into the filter using a regular old `term_to_binary(Key)`, so it will (incorrectly) treat two keys that are not identical but compare equal in ICU as distinct keys in its computation. I see a handful of paths that we could take: 1. Force the user to set `"collation": "raw"` in the design document options in order to use this reducer. 2. Merge this feature as-is and hide behind the "approximate" nature of the computation, documenting that it may overestimate the number of distinct keys by more than the stated uncertainty in the presence of such keys. 3. Compute a "canonical form" for each key and insert that into the filter instead. I don't even know if that's possible. My initial preference is for Option 2 but I wanted to bring this up before merging to see if others have strong opinions.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
