Bug 162601 - function UNIQUE is case-insensitive in Excel but case-sensitive in Calc
Summary: function UNIQUE is case-insensitive in Excel but case-sensitive in Calc
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Xisco Faulí
URL:
Whiteboard: target:25.8.0 target:25.2.1 target:24...
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2024-08-23 22:07 UTC by Regina Henschel
Modified: 2025-02-14 12:06 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test results for function UNIQUE (15.70 KB, application/vnd.oasis.opendocument.spreadsheet)
2024-08-23 22:07 UTC, Regina Henschel
Details
Same data but as xslx file to examine behavior in Excel (12.81 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2024-08-23 22:08 UTC, Regina Henschel
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Regina Henschel 2024-08-23 22:07:48 UTC
Created attachment 195990 [details]
Test results for function UNIQUE

The new function UNIQUE is case-sensitive in Calc, but case-insensitive in Excel.

Expected: The function behaves the same as in Excel.

[@tester: The new function UNIQUE does not react on option "Case sensitive" in Tools > Optiones > Calc > Calculate. That is no bug. The function UNIQUE is expected to be independent from these global settings.]
Comment 1 Regina Henschel 2024-08-23 22:08:39 UTC
Created attachment 195991 [details]
Same data but as xslx file to examine behavior in Excel
Comment 2 m_a_riosv 2024-08-24 01:45:22 UTC
Reproducible
Version: 25.2.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 85e4dc15d09dc3193870041b2814263971a27791
CPU threads: 16; OS: Windows 11 X86_64 (10.0 build 22631); UI render: Skia/Raster; VCL: win
Locale: es-ES (es_ES); UI: en-US
Calc: CL threaded
compared
Microsoft® Excel® para Microsoft 365 MSO (versión 2407 compilación 16.0.17830.20056) de 64 bits
Comment 3 Commit Notification 2025-02-03 15:41:31 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/0ef05087b54621caec96e72fc8aaf13f86a90bf9

tdf#162601: UNIQUE function is case-insensitive

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 4 Mike Kaganski 2025-02-03 16:05:16 UTC
See commit b0240bf12a94e71d1e2ebe3922afc1a3de5cd933 for the change that implements a correct case insensitivity, not limited to ASCII
Comment 5 Mike Kaganski 2025-02-03 16:09:44 UTC
And note that the case conversion is rather expensive, whatever can be done out of a loop, so must be moved out of the loop. That means, that the lambda passed to find_if must initialize its string to lowercase once, like this:

    auto it = std::find_if(aResPos.begin(), aResPos.end(),
                    [str = ScGlobal::pCharClass->lowercase(aStr)](const std::pair<SCSIZE, OUString>& aRes)
                    {
                        return ScGlobal::pCharClass->lowercase(aRes.second).equals(str);
                    }
Comment 6 Óvári 2025-02-03 20:23:37 UTC
Added to Release Notes/25.8
https://wiki.documentfoundation.org/ReleaseNotes/25.8#Calc

Please update as required.

Thank you
Comment 7 Commit Notification 2025-02-04 00:54:34 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/11e62f3a0566464186cef88f6133dbf88fe60a08

related: tdf#162601 UNIQUE function is case-insensitive also for non ASCII

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Xisco Faulí 2025-02-04 00:59:08 UTC
(In reply to Óvári from comment #6)
> Added to Release Notes/25.8
> https://wiki.documentfoundation.org/ReleaseNotes/25.8#Calc
> 
> Please update as required.
> 
> Thank you

Hi Óvári,
This is more a bug than an enhancement, thus, I've cherry-picked it to release branches:
 - https://gerrit.libreoffice.org/c/core/+/181063
 - https://gerrit.libreoffice.org/c/core/+/181064
Comment 9 Commit Notification 2025-02-04 12:02:38 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/29c9a61b96c88856784d2c4f9abafcfc0e979bc1

tdf#162601: UNIQUE function is case-insensitive

It will be available in 25.2.1.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2025-02-04 13:19:57 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/e348153cbd05391f0be124c026341b3055ada429

tdf#162601: UNIQUE function is case-insensitive

It will be available in 24.8.6.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 11 Commit Notification 2025-02-11 21:24:03 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "libreoffice-24-8-5":

https://git.libreoffice.org/core/commit/28e3f195794f4ea00d097b1eecea84ea2f604113

tdf#162601: UNIQUE function is case-insensitive

It will be available in 24.8.5.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 m_a_riosv 2025-02-14 12:06:36 UTC
Version: 25.8.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 41ab24cecd6ad74312843f113d2faa13259cdb7d
CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win
Locale: en-US (es_ES); UI: en-US
Calc: CL threaded